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
Installation
- npm
- yarn
npm i @formatjs/intl-durationformat
yarn add @formatjs/intl-durationformat
Anforderungen
-
Intl.ListFormatoder Polyfill -
Intl.NumberFormatoder Polyfill.
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')
}