Intl.DateTimeFormat#formatToParts() is not defined in older browsers — please manually polyfill it, example below
See original GitHub issueIn older browsers (I’ve tried IE 9.0, 10, and 11 as well as Firefox 52 and 56), attempting to load the cart produces:
TypeError: a.formatToParts is not a function
Thoughts on a potential polyfill?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Intl.DateTimeFormat.prototype.formatToParts() - MDN Web Docs
The formatToParts() method is useful for custom formatting of date strings. It returns an Array of objects containing the locale-specific ...
Read more >NPM package lacks browser support. Polyfill/Babel to fix?
dateTimeObj.toFormat() will try to use Intl.DateTimeFormat.prototype.formatToParts() not supported until Safari 11. Is it the case that the ...
Read more >Formatting Date and Time with Intl.DateTimeFormat
Intl.DateTimeFormat is an easy tool to formatting date and time without adding extra KB to your bundle size.
Read more >4 alternatives to Moment.js for internationalizing dates
RelativeTimeFormat , you can use the methods format() or formatToParts() (that returns an array with the parts of the output) to format a...
Read more >Index
In addition to objects that are predefined in the browser, you can define your ... formatToParts(), DateTimeFormat, Internationalization, Intl, JavaScript, ...
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 FreeTop 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
Top GitHub Comments
Thank you so much. This is extremely helpful.
Here is a link to my project that utilizes an optional polyfill loading pattern:
https://github.com/ChrisBrownie55/notably/blob/dabe00a22c8db1d18cc7f49fd7ef866138b4ecdc/src/index.tsx#L50-L59
The idea is that you can create some asynchronous functions that see if a polyfill is needed for a feature and then will load each polyfill and assign them to their respective names on the
window
. Once you have these, you can run them all and usePromise.all()
to wait for all of them.Once all of the asynchronous functions have ended, you can then import your
App.js
file dynamically and render it. The reason why we wait to importApp.js
is that if we try to use one of those features — used in the module’s global scope, not in a component/function — that need to be polyfilled within our app before it is polyfilled, then our app will crash.