Intl.DurationFormat
Traduction Bêta Non Officielle
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
Un polyfill conforme aux spécifications pour Intl.DurationFormat
Installation
- npm
- yarn
npm i @formatjs/intl-durationformat
yarn add @formatjs/intl-durationformat
Prérequis
Utilisation
Exemple simple
import '@formatjs/intl-durationformat/polyfill'
Import dynamique + détection de capacités
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')
}