-
Notifications
You must be signed in to change notification settings - Fork 301
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
ofJson<'T> fails to deserialize DateTime and returns a string instead #1344
Comments
This is tricky because |
@alfonsogarciacaro I don't think the problem is using |
I need to check if there's a solution, but right now Fable doesn't keep generic info for interfaces. So if you have I haven't decided yet how to represent reflection info in Fable 2 and how to make it work with |
Description
Given a record of type
A
that has with a field of typeDateTime
, thenofJson<seq<A>>
fails to deserialize theDateTime
field correctly and returns a string insteadRepro code
The following code will not work because
formatDate
is getting a string as an input and will throw error:Uncaught TypeError: d.getFullYear is not a function
because it is applying functions ofDate
on stringWorkaround
Change
ofJson<seq<NewsItem>>
toofJson<list<NewsItem>>
then it works just fineExpected and actual results
Expected to deserialize correctly but it instead fails
Related information
dotnet fable --version
): 1.3.8The text was updated successfully, but these errors were encountered: