timezone plugin broken in IE11 (unsupported method)
See original GitHub issueDescribe the bug
Intl.DateTimeFormat.formatToParts is not supported in IE11. This method is used by the timezone plugin here. Using the plugin in IE11 results in a runtime error.
Expected behavior IE11 support. Documentation states “Currently the following browsers are used for the ci system: Chrome on Windows XP, IE 8, 9, and 10 on Windows 7, IE 11 on Windows 10, latest Firefox on Linux, and latest Safari on OSX 10.8 and 10.11.”
Information
- Day.js Version 1…10.4
- OS: Windows 10
- Browser IE11
- Time zone: GMT-07:00 DST (Pacific Daylight Time)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top Results From Across the Web
timezone plugin broken in IE11 (unsupported method) #1489
Describe the bug Intl.DateTimeFormat.formatToParts is not supported in IE11. This method is used by the timezone plugin here. Using the plugin in IE11 ......
Read more >Internet Explorer 11 computed timezone bug - Stack Overflow
Indeed, this isn't supported on IE 11. See the Intl Compatibility Chart, under "DateTimeFormat" then "resolvedOptions().timeZone defaults to ...
Read more >Discussion: Dropping support for IE11 – Make WordPress Core
The proposed policy for WordPress is to end Internet Explorer 11 ... be broken in order to help identify development and testing needs....
Read more >Fix web compatibility issues using document modes and the ...
The Internet Explorer 11 Enterprise Mode site list lets you specify ... To see if this fix might help you, run through this...
Read more >Docs - Moment.js
If one needs internationalization or time zone support, Moment can get quite ... Some libraries are split into modules, plugins, or companion libraries....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I now found a way to make this work. There were 2 things that I had to change:
I used the syntax
dayjs.tz("2014-06-01 12:00", "America/New_York")which is usingformatToPartsunder the hood. When I useddayjs("2014-06-01 12:00").tz("America/New_York")IE 11 doesn’t complain anymore.After that change IE 11 then output
Invalid Datefor any kind of timezone. This had to do with an issue explained in here. I implemented the polyfill suggested there and it worked.It obviously feels a little hacky, but solves the problem. So I think it would be good if the documentation was updated and going a little more into detail how timezones can be made to work in IE 11.
@MattStaudinger
These expressions have different meanings and produce different results, they should not be used interchangeably.
This comment https://github.com/formatjs/formatjs/issues/2529#issuecomment-767387923 explains how to polyfill
Intl.DateTimeFormatproperly.