JavaScript Intl.DurationFormat() Constructor

Beginner
6 min read
Updated: Nov 2026
3 examples
Constructor

Definition

new Intl.DurationFormat(locales, options) builds a formatter for a duration record: an object with fields such as hours, minutes and seconds. Call format(duration) to get a locale string.

This API is new (ES2024). Always check typeof Intl.DurationFormat === "function" before using it.

Remember
new Intl.DurationFormat(locales, options)
fmt.format({ hours, minutes, seconds })

style: "long" | "short" | "narrow" | "digital"
guard: typeof Intl.DurationFormat === "function"

Syntax

Create a DurationFormat, then pass a duration object to format.

JavaScript
const fmt = new Intl.DurationFormat("en");
console.log(fmt.format({ hours: 1, minutes: 30, seconds: 5 }));
CallWhat it does
new Intl.DurationFormat("en")English duration labels (short by default in many engines).
fmt.format({ hours: 1, minutes: 30 })Turn a duration record into text.
{ style: "long" }Spell out units: hour, minutes.
{ style: "narrow" }Very compact unit labels.

A standard JavaScript constructor on the Intl object: create one with new Intl.DurationFormat(). No import required. Guard older engines. Siblings: Intl.getCanonicalLocales(), Intl.supportedValuesOf(), Intl.Collator(), Intl.DateTimeFormat(), Intl.DisplayNames(), Intl.ListFormat(), Intl.Locale(), Intl.NumberFormat(), Intl.PluralRules(), Intl.RelativeTimeFormat(), Intl.Segmenter().

Library declarations
JavaScript
// ECMAScript 2024 — Intl.DurationFormat
new Intl.DurationFormat(locales, options)
fmt.format(duration)

// duration : { years?, months?, weeks?, days?,
//              hours?, minutes?, seconds?, ... }
// options.style : "long" | "short" | "narrow" | "digital"

Parameters

ParameterDescription
localesOptional. Locale string or list, such as "en" or "de".
optionsOptional. Commonly style and unit display flags.
durationAn object with one or more time unit fields.

Return Value

Return ValueDescription
DurationFormat objectFrom the constructor.
stringFrom format: the localized duration text.

JavaScript Examples

Example 1 — Format a Simple Duration in English

Format 1 hour, 30 minutes and 5 seconds with the default English style.

JavaScript
const fmt = new Intl.DurationFormat("en");
const text = fmt.format({ hours: 1, minutes: 30, seconds: 5 });

console.log("Duration: " + text);
Try It Yourself

The Try It page first checks that Intl.DurationFormat exists, because it is new in ES2024. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.

How It Works

  1. Duration object. Pass only the units you care about.
  2. Default style. English often uses short labels such as hr and min.
  3. One string. format joins the units for display.

Example 2 — Spell Out Units with style long

Use style: "long" for full words like hour and minutes.

JavaScript
const fmt = new Intl.DurationFormat("en", { style: "long" });

console.log(fmt.format({ hours: 1, minutes: 30 }));
Try It Yourself

The Try It page first checks that Intl.DurationFormat exists, because it is new in ES2024. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.

How It Works

  1. Long labels. Units are spelled out for clearer reading.
  2. Fewer fields. Seconds were omitted, so they do not appear.
  3. Good for sentences. Long style fits status text and summaries.

Example 3 — German Short and French Narrow

The same duration reads differently in German short style and French narrow style.

JavaScript
const de = new Intl.DurationFormat("de", { style: "short" });
const fr = new Intl.DurationFormat("fr", { style: "narrow" });

console.log("de: " + de.format({ hours: 1, minutes: 30 }));
console.log("fr: " + fr.format({ minutes: 5, seconds: 30 }));
Try It Yourself

The Try It page first checks that Intl.DurationFormat exists, because it is new in ES2024. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.

How It Works

  1. Locale matters. German uses Std. and Min. for short style.
  2. Narrow is compact. French narrow drops spaces around some labels.
  3. Pick style per UI. Short for tables, long for sentences, narrow for tight spaces.

Browser & Runtime Support

Intl.DurationFormat is part of ES2024 (DurationFormat). Support is still growing: use a feature-detect before calling it.

✓ ES2024 · Growing support

Intl.DurationFormat

Supported in Chrome 129+, Edge 129+, Firefox 136+, Safari 18.4+ (approximate) and recent Node.js. Older engines need a guard or polyfill.

ES2024 Stage / standard
Google Chrome 129+ · Desktop & Mobile
Full support
Microsoft Edge 129+ · Chromium based
Full support
Mozilla Firefox 136+ · Desktop & Mobile
Full support
Apple Safari 18.4+ · macOS & iOS
Full support
Opera 115+ · Chromium based
Full support
Samsung Internet Recent versions · Android
Supported
Android WebView 129+ · Chromium based
Supported
Node.js 23+ · Server runtime
Supported
Deno Supported · JavaScript runtime
Supported
Bun Supported · JavaScript runtime
Supported
Internet Explorer Not supported
Not supported
Intl.DurationFormat Growing

Bottom line: Always guard: if (typeof Intl.DurationFormat === "function"). Do not assume every user browser has it yet.

Frequently Asked Questions

It formats a duration object (hours, minutes, seconds and other units) into a locale-aware string.
Not yet. It is an ES2024 feature. Always feature-detect before calling it.
A plain object with fields such as hours, minutes and seconds. You can omit units you do not need.
Common styles are long, short, narrow and digital. Exact wording depends on the locale.
Check typeof Intl.DurationFormat === "function" and fall back to your own string builder if it is missing.

Next: Intl.ListFormat

Learn how to format lists with locale conjunctions such as A, B, and C.

Intl.ListFormat tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful