Answer the question
In order to leave comments, you need to log in
How to solve the problem with different time zones of users?
Let's say the application has some kind of event that can be completed once a day. It is updated for use at 00:00. It is important to check what the user does every day (in order to keep track of the streak), so you need to store the date of the previous execution.
How to process the time of people from different time zones on the backend?
If you link the backing to a specific time zone, then different parts of the planet will have different update times, which is not very pleasant.
Store the date of the previous event in the user's time zone:
1. If you bind the application to the device's local time, you can wind the time and wind up the statistics.
Although it will be possible to put a check here so that it is impossible to send "results from the future"
2. If the application is tied to the time from the Internet, that is, for each user, store the date of the previous event in his time zone, then what to do if the user changes location and the time zone moves, for example, 12 hours ahead when flying to a new place, which means that there is a possibility that because of this, the user will miss one day to complete the event and his streak will be reset only because his previous date on the server and the new one that came again have a huge time difference due to a change in the location of the person. Although, in fact, for the person himself, the day has not yet passed
upd. The main problem is how to save the user a streak if he changes location on a conditional plane, if the date of his old time zone is stored on the back. Let's say today he hasn't done an event yet, but he flew to a place where a new day has already begun. Although in his old time, where he was before, he still manages to make and save his progress. And in fact, 24 hours have not yet passed from the previous saved date.
This applies to both the web version of the application and the mobile version. What are the solutions?
Answer the question
In order to leave comments, you need to log in
Just for such situations, they came up with GMT (UTC), in which, by the way, the time of the event is stored (with the right architecture). And the fact that the user sees the time in accordance with his time zone settings is already his problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question