Aller au contenu principal

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

npm Version size

Installation

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