Should the time zone be the preferred user in the web application?

I am working on a web application that should handle the transmission of certain events to people in many time zones.

There seems to be no reliable way to get the time zone from the client machine in a web application. I understand that we can get the offset, but the offset is not a time zone. (among other things, it does not consider DST for future dates).

This is a common thing or it is proposed to provide the time zone as the user's preference, and then visualize all the time in this users time zone.

+4
source share
1 answer

Yes. Store all timestamps in UTC, and then convert them to the user's time zone. You should make a list of time zones that include not only the offset from UTC, but also the use of DST (and for that matter, when they switch to / from DST).

Edit: In particular, you are looking for the tz database . This will provide almost everything you need.

+5
source

Source: https://habr.com/ru/post/1347590/


All Articles