facebook-csharp-sdk / simple-json

JSON library for .NET 2.0+/SL4+/WP7/WindowsStore with optional support for dynamic and DataContract
MIT License
380 stars 143 forks source link

Add support for DateTimeOffset #29

Closed haacked closed 11 years ago

haacked commented 11 years ago

Adding support for DateTimeOffset.

Also note that this wiki page: https://github.com/facebook-csharp-sdk/simple-json/wiki/Date-and-Time-Formats seems to be out of date. simple-json does support DateTime. At least the Poco serialization strategy does. It assumes ISO8601 (good choice!).

You might want to add a virtual method that allows a strategy to choose a different date format later. :)

prabirshrestha commented 11 years ago

definitely need to update the docs. for now added outdated warning.

virtual method is a great idea too. the more difficult this becomes the better it is for now. this will sort of force users to use iso8601 format. haven't had any requests yet. so will leave it unless someone actually needs it.

The ISO8601 support was only added when mvc4(json.net) decided to default to iso8601. glad that at this problem has been solved in .net now.

what about serialization?

haacked commented 11 years ago

Serialization? Oh yeah. One sec.

haacked commented 11 years ago

Done. :)

prabirshrestha commented 11 years ago

last one. need tests for DateTimeOffset? too.

sample for DateTime?.

https://github.com/facebook-csharp-sdk/simple-json/blob/261f26937173bf263825e8500f5b6f2055514ccf/src/SimpleJson.Tests/PocoDeserializerTests/NullableTypeDeserializeTests.cs#L64-L88 https://github.com/facebook-csharp-sdk/simple-json/blob/261f26937173bf263825e8500f5b6f2055514ccf/src/SimpleJson.Tests/PocoJsonSerializerTests/NullableSerializeTests.cs#L54-L61

haacked commented 11 years ago

Done!

prabirshrestha commented 11 years ago

serialization test missing. https://github.com/facebook-csharp-sdk/simple-json/blob/261f26937173bf263825e8500f5b6f2055514ccf/src/SimpleJson.Tests/PocoJsonSerializerTests/NullableSerializeTests.cs#L54-L61

haacked commented 11 years ago

Done. Sorry about that. Trying to do 10 things at once. ;)