ahausladen / JsonDataObjects

JSON parser for Delphi 2009 and newer
MIT License
413 stars 160 forks source link

Interpret TDateTime as UTC (and not as local date/time) #41

Closed maelh closed 6 years ago

maelh commented 6 years ago

Sometimes the date given to JsonDataObjects is in UTC already, for example when generated by functions such as EncodeDate(). When a local time offset is then subtracted internally by JsonDataObjects you can end up with a day earlier and some hours offset.

Maybe another property additionally to D[], such as DUtc[] would work, so you can intentionally set some dates as UTC and some as local time/date.

TJsonSerializationConfig.UseUtcTime is not enough, since TzSpecificLocalTimeToSystemTime() will be called regardless of that setting.

Thanks for the very well designed interface, btw!

maelh commented 6 years ago

Thanks, works well.