Intl.DurationFormat reaches Baseline Newly available
Web pages often display text indicating how long until an event occurs, or how much time has elapsed since one happened. Such strings typically communicate durations in hours, minutes, seconds, or other useful units of time.
As of March 2025, Intl.DurationFormat has become Baseline Newly available. The feature handles this task in the browser while accounting for internationalization needs, without requiring additional JavaScript.
How Intl.DurationFormat works
Intl.DurationFormat is a class that, when instantiated, returns a string describing a duration of time. You specify an object containing keys and values that correspond to the units of time you want a string generated for.
To return a string in a long format, pass a value of 'long' to the style option in the constructor's second argument. While the initial examples generate English strings, the internationalization nature of the feature means you can pass any valid locale and get results formatted in the supported language you need.
These examples only scratch the surface of what the feature can do. For a deeper dive into its capabilities, consult the Intl.DurationFormat documentation on MDN.



