Denys Séguret
Denys Séguret

Reputation: 382150

Print the time for a given location

Supposing I have

then what can I do if I want to format my date for this specific location, correctly dealing with daylight saving time when/if it occurs ? I'd prefer a standard based solution. I expect the solution to either include a reliable table of some sorts or to call some browser/computer magic.

Of course, as the offset is dependent of the moment, I can't just store the location as an offset.

Here are 2 points which ease the problem :

Upvotes: 1

Views: 99

Answers (1)

Mikael Östberg
Mikael Östberg

Reputation: 17156

Have a look at moment.js which support localization in a pretty nice way as well as time zones.

For the location issue, I would say you will have a really hard time solving that without an Internet connection. I would say the only way to solve it is to have your users enter a country (and maybe time zone) manually.

Upvotes: 1

Related Questions