Standard built-ins
Intl.DateTimeFormat.prototype.formatRange()
Format start and end instants using locale-specific range conventions; exact text depends on locale data.
Formal Syntax & Structure
javascript syntaxjavascript
formatter.formatRange(start, end)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| start | Date | Number | Start instant. |
| end | Date | Number | End instant. |
Return Value
String
Localized range text.
Working Example
Example Snippetjavascript
const f=new Intl.DateTimeFormat("en-US",{timeZone:"UTC"});console.log(typeof f.formatRange(new Date(0),new Date(86400000)));