xyncro / chiron

JSON for F#
https://xyncro.tech/chiron
MIT License
175 stars 41 forks source link

Dates should default to DateTimeOffset #19

Closed haf closed 9 years ago

haf commented 9 years ago

See https://msdn.microsoft.com/en-us/library/bb384267%28v=vs.110%29.aspx

Unless a particular DateTime value represents UTC, that date and time value is often ambiguous or limited in its portability. For example, if a DateTime value represents the local time, it is portable within that local time zone (that is, if the value is deserialized on another system in the same time zone, that value still unambiguously identifies a single point in time). Outside the local time zone, that DateTime value can have multiple interpretations. If the value's Kind property is DateTimeKind.Unspecified, it is even less portable: it is now ambiguous within the same time zone and possibly even on the same system on which it was first serialized. Only if a DateTime value represents UTC does that value unambiguously identify a single point in time regardless of the system or time zone in which the value is used.

You more often want to represent something as a point-in-time, than something 'local to where you computer/server is'.

kolektiv commented 9 years ago

Yeah I agree on this. I hadn't spent too much time with this bit as it's something i've not hit much, but I'm happy to change this. The lib will clearly be getting a major-ver bump anyway!

kolektiv commented 9 years ago

I'm not sure how we'd default this, but we do now have support for DateTimeOffset in #30, so I think this can be closed as sensibly supporting DTO where people select to use that in their F# types.