So to put it simply, we have a huge database of entries and the time associated with each entry is being saved in UTC in the standard format/syntax 2020-03-02T01:11:18.965Z
Now there are multiple users using the application that uses VueJS as the front-end and each user has the ability to set his own time zone.
Let’s say the user wants to calculate stats based on these entries for durations like Today, Yesterday, This Week, This Month.
Now for the Today stat, we would need to calculate data from entries that are between 00:00 and 23:59 in this user’s set timezone but the problem is that the entries are saved in the system in the UTC timezone for all users.
My question is - what is the best and most efficient (performance wise) way to carry out such calculations? The idea is to continue to keep all entries in UTC for everyone but changing timezones means that some entries might go in the previous day and some might go in the next day based on the time zone set which would affect the calculation of the stats completely.