Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

In next.js I have tried this in instrumentation-client.ts

import '@formatjs/intl-datetimeformat/polyfill'
import '@formatjs/intl-datetimeformat/locale-data/is'
import '@formatjs/intl-datetimeformat/add-all-tz'

But this always failed because of

if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'function') {
  Intl.DateTimeFormat.__addLocaleData({

__addLocaleData was never present.

If I do this however it works

delete (Intl as any).DateTimeFormat

require('@formatjs/intl-datetimeformat/polyfill')
require('@formatjs/intl-datetimeformat/add-golden-tz')
require('@formatjs/intl-datetimeformat/locale-data/is')

Something obvious I am doing wrong? I am just trying to add is-IS support for browsers like Chromium.
I´m not sure deleting the default DateTimeFormat object is good because then I have to add all locales I use manually.

You must be logged in to vote

Replies: 1 comment

Comment options

yes /polyfill has feature detection where it won't polyfill if the API is already there. You should follow this guide https://formatjs.github.io/docs/polyfills/intl-datetimeformat#dynamic-import--capability-detection

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.