Skip to content

[MOD][FIX] change tracker date fields with date-only storage

Victor Emanouilov requested to merge kroky/tiki:feature/tracker-timezones into master

[MOD][FIX] change tracker date fields with date-only storage to use 12am GMT timestamp instead of user's timezone 12am time, add a migration to fix existing timestamps for tracker date-only fields to use 12am GMT, fix conversion to gmdate in the search index

Historically, tracker date fields were storing timestamps based on user's timezone which were accurately capturing the point in time when user selected a time in a specific timezone but also created problems with date-only fields where 12am in user's timezone was used as a reference point. Date shifts occurred in the index or field display when display timezone was to the west of the entered timezone. This MR solves the issue by introducing the following changes:

  1. Dates-only fields now use 12am GMT to store the timestamp meaning we get the correct date in search index which also uses GMT.
  2. Display and usage of the timestamps has been fixed to assume all stored timestamps are 12am GMT.
  3. Migration script was added to convert existing timestamps to 12am GMT using closest matching day. Timezones GMT+13/14 will shift the date but I doubt these worked so far as a whole, so consider this a safe update.

I think we end up fixing the issue in the least disturbing way, still keeping timestamps as a way of storage. Existing date and time tracker fields are not changed.

Even though automated tests existing for different scenarios, @jonnybradley, @marclaporte it will be great if you can actually test this on a bigger database with timezone differences you have.

Edited by Marc Laporte

Merge request reports