-
Notifications
You must be signed in to change notification settings - Fork 833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intl.DateTimeFormat().resolvedOptions().timeZone returns wrong value of timezone #754
Comments
@vsharmaMitel this is the best way to detect user timezone - Which value did it return to you? |
@ellenaua I guess this problem is related to chromium version. In older version of chromium based on which I have created my desktop application, it shows value of |
I see, it's resolved then |
so,what is the solution? |
Is there a solution? I get the totally wrong timezone on windows 11 with all browsers. Chrome, Firefox, Brave all got Etc/GMT-8 but Asia/Taipei is the right one. |
Can you tell me your windows system timezone? |
@vsharmaMitel UTC+8. Thanks for reply I reset and set timezone again. Finially solved it. |
Not a problem. I just checked by setting system time to UTC+8 Taipei, and i am able to get the timezone as 'Asia/Taipei' in browser. |
I'm getting |
@rodrigochapeta Seems to be a bug in Chromium. Firefox actually returns the correct value Tested on: Firefox |
May I know how exactly to test if this works correctly Intl.DateTimeFormat().resolvedOptions().timeZone ? How exactly does this fetch the location of the user? |
I want to fetch timezone in IANA form for a user using javascript function
Intl.DateTimeFormat().resolvedOptions().timeZone
. But this function gives incorrect IANA time zone value.I have used moment.js library's function
moment.tz.guess(true)
. But this also gives same incorrect value. On further analysis, I came to know that this also uses same native js functionIntl.DateTimeFormat().resolvedOptions().timeZone
internallyvar timeZone = moment.tz.guess(); // "America/Los_Angeles"
or
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; // "America/Los_Angeles"
Though the user has set system time to (UTC - 07:00) Mountain Time (US & Canada), but still this function gives value as "America/Los_Angeles" which is Pacific standard/daylight timezone. Whereas expected value should be "America/Denver".
Another thing is that this issue started occurring after the daylight savings adjustment came into picture i.e. around mid of March. Beforehand it worked fine. The user is located in Utah, USA.
Can anyone suggest probable root causes of this issue? Also please suggest any workaround, would be very helpful..
The text was updated successfully, but these errors were encountered: