Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported CLR with nullable DataTime #86

Open
MostafaEsmaeili opened this issue Oct 17, 2017 · 4 comments
Open

Unsupported CLR with nullable DataTime #86

MostafaEsmaeili opened this issue Oct 17, 2017 · 4 comments

Comments

@MostafaEsmaeili
Copy link

Hi pals,
I have a class of "Person" in which there is a field named "BirthDate" (public DateTime? BirthDate) and it is nullable. When the GraphQL is going to execute the query, I receive the following error message:

Unsupported CLR type ``DateTime''

Could you please help me with the issue?

Yours Sincerely

@einer20
Copy link

einer20 commented Nov 4, 2017

in the readme file, the developer cleary said that DateTime type is not yet supported.

@mstephano
Copy link

mstephano commented Apr 18, 2018

Any news on the fix for DateTime please? I really like this library, so much easier to learn and use than the other one.

@JimmyAtSchotte
Copy link

I got rid of the "Unsupported CLR type ``DateTime''" message by adding this scalar to the scheme

schema.AddScalar(new { year = 0, month = 0, day = 0 }, ymd => new DateTime(ymd.year, ymd.month, ymd.day));

@mstephano
Copy link

mstephano commented Apr 19, 2018

Thank you very much Jimmy, I have tested by adding your code and I can finally use
schema.AddType<MyObject>().AddAllFields() on all of my entities!!

This is a great day!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants