The Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. The constructors for Collator, NumberFormat, and DateTimeFormat objects are properties of the Intl object. This page documents these properties as well as functionality common to the internationalization constructors and other language sensitive functions.
The Intl.Collator object is a constructor for collators, objects that enable language sensitive string comparison.
The Intl.Collator.supportedLocalesOf() method returns an array containing those of the provided locales that are supported in collation without having to fall back to the runtime's default locale.
The Intl.DateTimeFormat object is a constructor for objects that enable language sensitive date and time formatting.
The Intl.getCanonicalLocales() method returns an array containing the canonical locale names. Duplicates will be omitted and elements will be validated as structurally valid language tags.
The Intl.NumberFormat object is a constructor for objects that enable language sensitive number formatting.
The Intl.NumberFormat.supportedLocalesOf() method returns an array containing those of the provided locales that are supported in number formatting without having to fall back to the runtime's default locale.
The toLocaleString() method returns a string representing the elements of the array. The elements are converted to Strings using their toLocaleString methods and these Strings are separated by a locale-specific String (such as a comma “,”).
The Intl.Collator.prototype.compare property returns a getter function that compares two strings according to the sort order of this Collator object.
The Intl.Collator.prototype property represents the prototype object for the Intl.Collator constructor.
The Intl.Collator.prototype.resolvedOptions() method returns a new object with properties reflecting the locale and collation options computed during initialization of this Collator object.
The Intl.DateTimeFormat.prototype.format property returns a getter function that formats a date according to the locale and formatting options of this Intl.DateTimeFormat object.
The Intl.DateTimeFormat.prototype property represents the prototype object for the Intl.DateTimeFormat constructor.
The Intl.DateTimeFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the locale and date and time formatting options computed during initialization of this DateTimeFormat object.
The Intl.DateTimeFormat.supportedLocalesOf() method returns an array containing those of the provided locales that are supported in date and time formatting without having to fall back to the runtime's default locale.
The toLocaleString() method returns a string with a language sensitive representation of this number.
The Intl.NumberFormat.prototype.format property returns a getter function that formats a number according to the locale and formatting options of this NumberFormat object.
The Intl.NumberFormat.prototype property represents the prototype object for the Intl.NumberFormat constructor.
The Intl.NumberFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the locale and number formatting options computed during initialization of this NumberFormat object.
The toLocaleDateString() method returns a string with a language sensitive representation of the date portion of this date. The new locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function. In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent.