JavaScript Intl Object
Intl is the namespace for the internationalization API, which formats dates, numbers, currencies, lists and plurals, and sorts text, for any language and region.
Description
The Intl object is the namespace for the ECMAScript Internationalization API. It contains constructors that format and compare values according to the conventions of a locale, such as 'en-AU' or 'de-DE': DateTimeFormat, NumberFormat, RelativeTimeFormat, ListFormat, PluralRules, Collator, Segmenter, DisplayNames and DurationFormat.
Methods such as toLocaleString() and localeCompare() use Intl behind the scenes. Creating a formatter once and reusing it is faster than calling those methods repeatedly. If you leave out the locale, the user's own language settings are used.
Intl also provides Intl.Segmenter, which splits text into graphemes, words or sentences correctly for any language, including languages without spaces between words, and Intl.DisplayNames, which gives the names of languages, regions and currencies in the user's language. Intl.supportedValuesOf() lists the calendars, currencies, time zones and units the browser supports, which helps when building selection menus.
Syntax
new Intl.DateTimeFormat(locales, options)
new Intl.NumberFormat(locales, options)Example
Browser Support
The following information will show you the current browser support for the Intl object. Hover over a browser icon to see the version that first introduced support for this object.
Desktop





Tablets & Mobile





