# formatDateRange

Industry: Core

## Signature

```ts
formatDateRange(start: string, end: string, locale?: string | string[], options?: DateTimeFormatOptions): string
```

Format a plain date range using the Temporal Intl.DateTimeFormat formatRange API.

- Plain counterpart of `formatZonedRange` — same parameter order and option shape.
- Uses Temporal.PlainDate.from for both endpoints; no timezone is involved.
- Formats as Temporal's ECMA-402 PlainDate format does, through the runtime's `Intl.DateTimeFormat#formatRange`: `timeZoneName` is ignored, and a `timeStyle` without `dateStyle`, or only time fields, returns `""`.
- **Compatibility:** before 1.16.0 `timeZoneName` alone returned `""`; only that sentinel became a value.
- Locale elides shared fields between `start` and `end` (e.g. same month/year).
- Returns "" for invalid input on either endpoint.
- Output is normalized: dash separators become ASCII "-" (unspaced between digits, spaced otherwise), and no-break, narrow and thin spaces become U+0020.
- `options` null returns `""`, as ECMA-402's CoerceOptionsToObject rejects it. Any other non-object — a string, a number, a boolean — formats with the defaults, as `Intl.DateTimeFormat` does: CoerceOptionsToObject calls ToObject on it and the wrapper carries no recognised option. Only `null` and `undefined` are special-cased.
- A `chinese` or `dangi` date follows the observatory the standard names: Purple Mountain Observatory for `chinese`, KASI for `dangi`. A runtime that prints a different date for one of them returns `""` for any format with a year, month, day or era in that calendar. A runtime that prints the observatory's date keeps its own text. A format with only a weekday field always returns its text.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `start` | `string` | ISO PlainDate string (range start) |
| `end` | `string` | ISO PlainDate string (range end) |
| `locale` | `string` \| `string[]` | optional locale tag (default: runtime default), or a preference list of tags (ECMA-402) |

## Options

**options**

optional Intl.DateTimeFormatOptions

Type: [`DateTimeFormatOptions`](/gmt/reference/types/DateTimeFormatOptions/).

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `…Intl.DateTimeFormatOptions` | — | — | Every field of [`DateTimeFormatOptions`](/gmt/reference/types/DateTimeFormatOptions/), as [ECMA-402](https://tc39.es/ecma402/#sec-createdatetimeformat) defines it. |

## Returns

localized range string or "" when invalid

## Related types

- [`DateTimeFormatOptions`](/gmt/reference/types/DateTimeFormatOptions/)

## Examples

```ts
import { formatDateRange } from "@northguild/gmt/plain/format";

formatDateRange("2024-02-03", "2024-02-05", "en-GB", { dateStyle: "long" }) // "3 - 5 February 2024"
```

## Source

[plain/format/formatDateRange.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/plain/format/formatDateRange.ts)
