How do you determine the current date and time in the user's local time zone in Elm?

I want to get a Date in elm that represents the local date and time of the user. I looked at the core of the date of the module , as well as the elm-time .

The elm-time package has ZonedDateTime, but it needs to specify a value TimeZone, and therefore the time zone must be known in advance.

At the heart of this problem is the reliable determination of the user's time zone . The best solution that I came up with, too naively considered acceptable, is to pass the user’s timezone offset through javascript as the application flag and change the UTC date accordingly.

+4
source share

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


All Articles