-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Conversation
…nes and UTC time.
OK, now I'm really confused... unit tests still fail on Travis, but universal time in timezone +0000 gives different milliseconds as UTC time during test-run. This is normally not possible, or it's getting too late and I'm not thinking clearly... :-( This just demonstrates how hard it is to get this timezone stuff 100% right ;-) |
OK, not too late yet -- figured out why my test was still wrong ;-) Hopefully fixing for real this time... |
…ue for GMT+1 timezone, oops)
i think it's a good idea to implement this change. Before using the better Date serialization in 0.22, i was using Also, MSDN says that the round-trip specifier is informed by ISO 8601 as well as the sortable specifier:
|
Let me add these examples of the new output to clarify the improvement. Fact: I am currently in the GMT+1 timezone.
This is what things used to look like before the changes in this pull request:
|
Another point i'd like to mention is that the round-trip specifier allows for more precision (AFAIK) than the one we're currently using. |
Alright, @dot-i already mentioned that up top! Cast my vote in for more precision, then. |
+1 I agree that this would be a welcome addition. |
|
||
Assert.Equal(String.Format("{{\"createdOn\":\"2013-12-25T12:10:30.0000000{0}\"}}", GetTimezoneSuffix(DateTime.Now)), model); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line.. splitting hairs, but @thecodejunkie will shout if I pull it in with such things in there ;)
Other than a random blank line it looks good to me 👍 |
I just fixed the blank line ;) |
Awesome 😁 |
Improved the ISO8601 format to use the round-trip format to supports milliseconds, timezones and UTC time.
Added three unit tests to make sure the serialization has the required result for all different kinds of datetimes (Local, UTC and Unspecficied) in both formats, ISO8601 and WCF.
Also made the ISO8601DateFormat locally overridable on the DefaultJsonSerializer, just like the RetainCasing JSON setting.