Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptJavaScript Intl Complete Reference

JavaScript Intl Complete Reference

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 neveropen = new Intl.DateTimeFormat('zh-CN', { timeZone: 'UTC' });
    const result = neveropen.resolvedOptions();
    console.log(result.locale);
    console.log(result.calendar);
    console.log(result.timeZone);
      
    const neveropen1 = new Intl.DateTimeFormat('LT');
    const result1 = neveropen1.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.
Try
supportedLocalesOf() It can be collated without resorting to the runtime’s default locale.
Try
getCanonicalLocales() Returns an array containing the canonical locale names.
Try
format() Returns a string with a language-specific representation of the list.
Try
resolvedOptions() The location and style formatting choices were made when the current IntlListFormat object was built.
Try
formatToParts() Format a list of values in a locale-aware fashion.
Try
supportedLocalesOf() The provided locales are supported in list formatting.
Try
supportedLocalesOf() The provided locales are supported in date and time formatting.
Try
resolvedOptions()  The locale, date, and time formatting options are computed during the initialization of this DateTimeFormat object.
Try
formatRangeToParts() The formatted date range is produced by DateTimeFormat formatters.
Try
format() The locale and formatting options of this IntlDateTimeFormat object.
Try
formatRange() The locale and options provided when instantiating IntlDateTimeFormat object.
Try
formatToParts() Allows locale-aware formatting of strings produced by DateTimeFormat formatters.
Try

RELATED ARTICLES

Most Popular

Recent Comments