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

Unable to parse 2015-04-27T15:54:02.763033Z into a DateTime #40

Closed
boudinov opened this issue Apr 27, 2015 · 3 comments
Closed

Unable to parse 2015-04-27T15:54:02.763033Z into a DateTime #40

boudinov opened this issue Apr 27, 2015 · 3 comments

Comments

@boudinov
Copy link

Hello,
I am using FullSerializer in Unity, and for certian DateTimes, I get fsResult from TryDeserialize with HasWarnings = true, and a formatted message like the one above.
Note that there are no such problems for DateTimes with 7 deciseconds symbols behind the last Dot.

For example, 2015-04-27T15:54:02.7630331Z works fine.

The result come from the default Json.NET serializer with Microsoft Web Api.
Any idea if this is a bug?

And btw, fsResult.HasErrors method should first check if _message != null?

Thanks

@jacobdufault
Copy link
Owner

Thanks, I've fixed the HasWarnings issue. I'll push it up shortly.

I'm not terribly familiar with DateTime formatting/parsing. The current does does it as follows:

DateTime result;
if (DateTime.TryParse(data.AsString, null, DateTimeStyles.RoundtripKind, out result)) {
    instance = result;
    return fsResult.Success;
}

return fsResult.Fail("Unable to parse " + data.AsString + " into a DateTime");

Any ideas? It could very well be a bug in mono.

@boudinov
Copy link
Author

Yeah, it seems it is a bug for Unity's Mono only. It parses only datetimes with 7 milisecond symbols.

@jacobdufault
Copy link
Owner

Closing since there isn't much I can do on my end besides reimplementing DateTime.

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

2 participants