Skip to main content

Intl.DurationFormat

A spec-compliant polyfill for Intl.DurationFormat

npm Version size

Installation​

npm i @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')
}