# Intl.DurationFormat

> The `Intl.DurationFormat` JS object enables language-sensitive formatting of durations.

## How do I format a duration like 1h 30m in JavaScript?

The object that formats time durations according to the locale, for example '1 hr, 30 min' or '1:30:00'. Supports 'long', 'short', 'narrow' and 'digital' styles.

- Topic: Intl
- Type: object
- Browser support: Chrome 129+, Chrome Android 129+, Edge 129+, Firefox 136+, Firefox Android 136+, Safari 16.4+, Safari iOS 16.4+

## Example

Wrong:

```js
const fmt = new Intl.DurationFormat(locale);
fmt.format(5400000);
```

Right:

```js
const fmt = new Intl.DurationFormat(locale, {
  style: 'short',
});
fmt.format({ hours: 1, minutes: 30 });
```

`format()` takes a duration object with named units; a plain number of milliseconds throws a `TypeError`.

## Common mistakes

- Passing milliseconds directly to `format()`, which throws a `TypeError`.

## Key points

- `format()` receives an object like `{ hours: 1, minutes: 30 }`, not a number of milliseconds.
- The locale comes from the user or the app settings, not a hardcoded 'en-US'.
- The formatter is created once and reused, not in every render.

## Interview questions

### How do I show a duration like a timer, such as 1:30:00?

Use `style: 'digital'`, which formats hours, minutes and seconds with colons.

### Does Intl.DurationFormat balance units, like turning 90 minutes into 1 hour 30 minutes?

No. It formats the units you pass as they are, so convert milliseconds into hours and minutes yourself first.

## Related cards

- [Intl](https://wonderium.dev/js/intl.md)
- [Intl.RelativeTimeFormat](https://wonderium.dev/js/intl-relative-time-format.md)
- [Intl.NumberFormat](https://wonderium.dev/js/intl-number-format.md)
- [i18n](https://wonderium.dev/web/i18n.md)

---

- Level: [JavaScript](https://wonderium.dev/js.md)
- HTML version: https://wonderium.dev/js/intl-duration-format
- Last updated: 2026-11-25
