gawati / gawati-data

Gawati Data server is a component of the Gawati application a legal data exchange platform
Other
2 stars 0 forks source link

dateTimes in documents need to be time zone agnostic #8

Open kohsah opened 6 years ago

kohsah commented 6 years ago

Refer to this thread, specifically:

So this is the mix so to speak: Partners are in different time zones to each other (and to ALL) ALL is in a different time zone. It might seem recording date-time in UTC and capturing the time-zone offset should suffice for safely syncing data across servers. But then i realized, Time Zone information itself changes more often than imagined (see here for instance, https://www.timeanddate.com/news/time/ there were 22 changes to time zones just in 2017).

So to be safe the document needs to capture created & modified dates in terms of 3 data points to be always functional:

1) dateTime (in local Date Time of the partner) 2) timezone Offset to UTC (in hours) 3) timezoneLocation (the nearest timezone location to where the data is being entered .. see the interactive map here: https://momentjs.com/timezone/ )

We then use this information to calculate the corresponding dateTime in UTC for cross geographical dateTime comparisons ...

The other option is to store the dateTime (1) as UTC itself...and then render that to local dateTime wherever the user sees the created / modified date on the UI...

We need to change how created and modified dates are captured in the gawati documents. Currently they use a 'datetime with timezone' format, but don't capture timezone location info. Similarly date comparisons must be made in utc time and not in the native times (for.e.g when ordering documents by date)