0

Unfortunately some browsers don't support some locales using Intl.DateTimeFormat. In my case 'kk' locale in Chrome (https://source.chromium.org/chromium/chromium/src/+/master:third_party/icu/scripts/chrome_ui_languages.list). You can test your locale in console:

Intl.DateTimeFormat.supportedLocalesOf('kk')

If it returns empty array [] it means that it doesn't support.

My question is how to add missing locale? I mean may be there is a Polyfill for that? I'm using Vuejs 2

Eazy
  • 3,212
  • 5
  • 24
  • 40

1 Answers1

1

Finally found solution to use Polyfill:

npm i @formatjs/intl-datetimeformat

Then in your code:

import '@formatjs/intl-datetimeformat/polyfill-force’ // Using force to use our polyfill
import '@formatjs/intl-datetimeformat/locale-data/kk’ // Add locales you want
import '@formatjs/intl-datetimeformat/locale-data/ru’ // Add locales you want
import '@formatjs/intl-datetimeformat/add-all-tz' // Add ALL tz data
Eazy
  • 3,212
  • 5
  • 24
  • 40
  • What I dislike about this library is that it does not work without `polyfill-force` and if you decide to actually use `polyfill-force`, you must import all the locales you would like to use and not utilise the locales that already exist within the browser which inflates the compiled package. Has anyone else found other ways around this? – Koshux Sep 06 '21 at 14:04