0

I have been trying to find the precise timezone of the user. I have used the following code:

var timezone = jstz.determine();
console.log('Your timezone is: ' + timezone.name());

but problem comes when two or more zones have same UTC. For ex:

(UTC+09:00) Seoul
(UTC+09:00) Tokoyo
(UTC+09:00) Yakutsk

Say my time zone is Yakutsk but it may return:

"Asia/Tokyo"

The above code works fine in chrome but in Mozilla & IE, it fails to give precise timezone. Is there any way get the precise timezone of the client using JS?

Brigand
  • 84,529
  • 20
  • 165
  • 173
  • 1
    clearly `jstz` isn't worth using ... firefox natively tells me **GMT+1100 (AUS Eastern Standard Time)** - the only thing wrong with that is that it's Daylight Saving Time at the moment – Jaromanda X Nov 19 '15 at 10:14
  • How is the browser supposed to know what exact time zone you're in? You may even need to use the geolocation api if you want to get the right name. – Cerbrus Nov 19 '15 at 10:29
  • The short answer is - *you can't*. The longer answer is in the dup question, but no approach is currently foolproof. Eventually the `Intl` API will be widespread and then you can rely on it, but there is no *precise* option for now. – Matt Johnson-Pint Nov 19 '15 at 20:23

0 Answers0