Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Intl.DateTimeFormat.prototype.formatRangeToParts()

2 tags 1 category

The formatRangeToParts() method of Intl.DateTimeFormat instances returns an array of objects representing each part of the formatted string that would be returned by formatRange(). It is useful for building custom strings from the locale-specific tokens.

Return value: An Array of objects containing the formatted date range in parts. Each object has three properties, type, value, and source, each containing a string. The string concatenation of value, in the order provided, will result in the same string as formatRange(). The type may have the same values as formatToParts(). The source can be one of the following:

Return value: startRange The token is a part of the start date. endRange The token is a part of the end date. shared The token is shared between the start and end; for example, if the start and end dates share the same day period, that token may get reused. All literals that are part of the range pattern itself, such as the ” – ” separator, are also marked as shared.

Syntax example: formatRangeToParts(startDate, endDate)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…