Intl in JavaScript is an object which is used for ECMAScript Internationalization API namespace.
Intl.function()
Example 1: Below examples illustrate the IntlDateTimeFormatprototyperesolvedOptions() method in JavaScript:
Javascript
<script> const geeks = new Intl.DateTimeFormat( 'zh-CN' , { timeZone: 'UTC' });
const result = geeks.resolvedOptions();
console.log(result.locale);
console.log(result.calendar);
console.log(result.timeZone);
const geeks1 = new Intl.DateTimeFormat( 'LT' );
const result1 = geeks1.resolvedOptions();
console.log(result1.locale);
console.log(result1.calendar);
</script> |
Output:
zh-CN gregory UTC lt gregory
JavaScript Intl Methods: The complete list of JavaScript Intl methods are listed below:
Method |
Description | Example |
---|---|---|
resolvedOptions() | The locale and collation options are computed during the initialization of this Collator object. | |
supportedLocalesOf() | It can be collated without resorting to the runtime’s default locale. | |
getCanonicalLocales() | Returns an array containing the canonical locale names. | |
format() | Returns a string with a language-specific representation of the list. | |
resolvedOptions() | The location and style formatting choices were made when the current IntlListFormat object was built. | |
formatToParts() | Format a list of values in a locale-aware fashion. | |
supportedLocalesOf() | The provided locales are supported in list formatting. | |
supportedLocalesOf() | The provided locales are supported in date and time formatting. | |
resolvedOptions() | The locale, date, and time formatting options are computed during the initialization of this DateTimeFormat object. | |
formatRangeToParts() | The formatted date range is produced by DateTimeFormat formatters. | |
format() | The locale and formatting options of this IntlDateTimeFormat object. | |
formatRange() | The locale and options provided when instantiating IntlDateTimeFormat object. | |
formatToParts() | Allows locale-aware formatting of strings produced by DateTimeFormat formatters. |