I am trying to solve an issue in a web application where the timezone detected is wrong for Windows users. I'm really not sure how the Windows timezones work internally vs. IANA timezones, but in the web application the timezone picked up from the user browser is different from the one displaying on the clock (and the one selected in the Windows settings).
The Windows timezone in question is (UTC-07:00) Chihuahua, La Paz, Mazatlan
, notice the UTC-7.
When you set this timezone in Windows the right time is displayed on the clock (UTC-7). The problem is in the web browsers, somehow it keeps detecting a UTC-6 timezone:
new Date()
would print at the end: "GMT-0600 (Central Standard Time)"
and Intl.DateTimeFormat().resolvedOptions().timeZone
would give "America/Chihuahua" (which is a UTC-6 timezone).
Without relying on geolocation or manually setting the timezone through code, is there any additional step that needs to be made to detect the right timezone in this particular case?
What is the exact difference between Windows timezones and IANA timezones and why does Windows group toghether clearly different timezones into one (Chihuahua, UTC-6 together with Mazatlan, UTC-7)?