Intl.DurationFormat
Traducción Beta No Oficial
Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →
Un polyfill compatible con la especificación para Intl.DurationFormat
Instalación
- npm
- yarn
npm i @formatjs/intl-durationformat
yarn add @formatjs/intl-durationformat
Requisitos
Uso
Sencillo
import '@formatjs/intl-durationformat/polyfill'
Importación dinámica + detección de capacidades
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')
}