13631 shaares
345 private links
345 private links
Yes I am aware this API can be useful. The relativeTimeFormat is often used in the web apps.
Intl.DateTimeFormat: format dates and timesIntl.RelativeTimeFormat: "yesterday", "in 3 days"Intl.DurationFormat: "2 hours, 5 minutes and 30 seconds"Intl.NumberFormat: format numbers, currencies, and unitsIntl.ListFormat: "Apples, Oranges, and Bananas"Intl.PluralRules: figure out plural forms correctlyIntl.Segmenter: break text into words, sentences, or graphemesIntl.Collator: sort strings in a locale-aware way
All Intl functions have roughly the same shape:
- Pick a locale.
- Pick some options.
- Create a formatter.
- Reuse that formatter with your data.