Skip to content Skip to sidebar Skip to footer

Internet Explorer 11 Computed Timezone Bug

I am aware of the origin of the problem and googled like half a day, but still couldn't find any good workarounds or solutions for this. Our Angular 7+ application use a timezone i

Solution 1:

Indeed, this isn't supported on IE 11. See the Intl Compatibility Chart, under "DateTimeFormat" then "resolvedOptions().timeZone defaults to the host environment".

If you must support IE 11, then you'll need to resort to older methods of guessing the user's time zone. For a long time, jsTimeZoneDetect, was the only reliable method for this. However, it's not been maintained so I wouldn't recommend it these days.

Later, Moment-Timezone added the moment.tz.guess() function. Since this is still maintained to a certain degree, that's probably your only option.

Both libraries will use the Intl API when available, but then fall back to an algorithm that interrogates the Date object for various offsets at certain key DST transition dates. This is why it's a "guess". It is usually pretty accurate, or at least close, but cannot always identify the exact setting of the user's computer in certain edge cases.

The other drawback is that these libraries have to ship time zone data to the browser, which comes with the overhead of that data size. This is mitigated somewhat by using one of the truncated data files, such as moment-timezone-with-data-10-year-range.min.js.

If you don't have to support IE 11 and older browsers, then you can just use the Intl API directly, as you showed in your question.

Post a Comment for "Internet Explorer 11 Computed Timezone Bug"