Store Unix Time instead of ISO formatted string
See original GitHub issueCurrently, we store datetime as an ISO formatted string (for example, "2022-03-23 20:58:40.584444"
).
This has the advantage of being human-readable. However, this comes with the big disadvantage that we don’t know what timezone we’re talking about. This leads to various problems. For example, when global users are updating documents. Or when the backend updates documents before and after the system timezone changes.
Some of these issues have been addressed already, for example, by trying to convert to and from the users’ timezone. However, the underlying issue remains: we’re storing times without the timezone.
A nice solution would be to store the Unix Time or UTC timestamp. (The unix time would also make comparing and calculating with times easy – after all, it’s just a number.) When we need to display the timestamp, we can convert it to the appropriate timezone.
Existing time stamps could be assumed to be in the timezone from System Settings, before conversion.
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:7 (4 by maintainers)
Top GitHub Comments
@barredterra @ankush
We can modify the scheduler’s timezone to some other configured value if that’s only roadblocker. It’s a very localized changed in
scheduler.py
It’s better to keep scheduler in local timezone because ERPNext has few events which are best triggered at midnight (imagine birthday reminders, would be weird af to receive them 5 hours before that day starts 😄)