Zum Hauptinhalt springen

Intl.DurationFormat

Inoffizielle Beta-Übersetzung

Diese Seite wurde von PageTurner AI übersetzt (Beta). Nicht offiziell vom Projekt unterstützt. Fehler gefunden? Problem melden →

Eine spezifikationskonforme Polyfill für Intl.DurationFormat

npm Version size

Installation

npm i @formatjs/intl-durationformat

Anforderungen

Verwendung

Einfach

import '@formatjs/intl-durationformat/polyfill'

Dynamischer Import + Funktionserkennung

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')
}