Intl.DurationFormat.prototype.resolvedOptions()

Baseline 2025
Newly available

Since March 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

The resolvedOptions() method of Intl.DurationFormat instances returns a new object with properties reflecting the options computed during initialization of this DurationFormat object.

Syntax

js
resolvedOptions()

Parameters

None.

Return value

A new object with properties reflecting the options computed during the initialization of this DurationFormat object. The object has the following properties, in the order they are listed:

locale

The BCP 47 language tag for the locale actually used, determined by the locale negotiation process. Only the nu Unicode extension key, if requested, may be included in the output.

numberingSystem

The value provided for this property in the options argument, or using the Unicode extension key "nu", with default filled in as needed. It is a supported numbering system for this locale. The default is locale dependent.

style

The value provided for this property in the options argument, with default filled in as needed. It is either "long", "short", "narrow", or "digital". The default is "short".

years, yearsDisplay, months, monthsDisplay, weeks, weeksDisplay, days, daysDisplay, hours, hoursDisplay, minutes, minutesDisplay, seconds, secondsDisplay, milliseconds, millisecondsDisplay, nanoseconds, nanosecondsDisplay

The values provided for these properties in the options argument, with defaults filled in as needed. For the valid values and defaults for each, see the options argument of the constructor.

fractionalDigits Optional

The value provided for this property in the options argument. It is only present if specified in options. It is an integer from 0 to 9, inclusive.

Examples

Using the resolvedOptions method

js
const duration = new Intl.DurationFormat("en");
const usedOptions = duration.resolvedOptions();

usedOptions.locale; // "en"
usedOptions.numberingSystem; // "latn"
usedOptions.years; // "long"
usedOptions.yearsDisplay; // "auto"
usedOptions.style; // "long"

Specifications

Specification
Intl.DurationFormat
# sec-Intl.DurationFormat.prototype.resolvedOptions

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
resolvedOptions
Chrome – Full support
Chrome 129 (Release date: 2024-09-17)
footnote Full support
Edge – Full support
Edge 129 (Release date: 2024-09-19)
footnote Full support
Firefox – Full support
Firefox 136 (Release date: 2025-03-04)
footnote Full support
Opera – Full support
Opera 115 (Release date: 2024-11-27)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 129 (Release date: 2024-09-17)
footnote Full support
Firefox for Android – Full support
Firefox for Android 136 (Release date: 2025-03-04)
footnote Full support
Opera Android – Full support
Opera Android 86 (Release date: 2024-12-02)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 28 (Release date: 2025-04-02)
footnote Full support
WebView Android – Full support
WebView Android 129 (Release date: 2024-09-17)
footnote Full support
WebView on iOS – Full support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Bun – Full support
Bun 1.0.3 (Release date: 2023-09-22)
footnote Full support
Deno – Full support
Deno 1.46 (Release date: 2024-08-22)
footnote Full support
Node.js – Full support
Node.js 23 (Release date: 2024-10-16)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also