Intl.DurationFormat
A spec-compliant polyfill for Intl.DurationFormat
Installation
- npm
- yarn
npm i @formatjs/intl-durationformat
yarn add @formatjs/intl-durationformat
Requirements
Usage
Simple
import '@formatjs/intl-durationformat/polyfill'
Dynamic import + capability detection
import {shouldPolyfill} from '@formatjs/intl-durationformat/should-polyfill'
async function polyfill(locale: string) {
const unsupportedLocale = shouldPolyfill(locale)
// This locale is supported
if (!unsupportedLocale) {
return
}
// Load the polyfill 1st BEFORE loading data
await import('@formatjs/intl-durationformat/polyfill-force')
}