# mapZonedDatesInRange

Industry: Core

## Signature

```ts
mapZonedDatesInRange(startZonedDateTime: string, endZonedDateTime: string, stepDays?: number, options?: { maxPieces?: number; }): string[]
```

Return an array of plain ISO date strings covering the inclusive date range between two zoned datetimes.

- Both datetimes must have the same time zone: identifiers of one zone count as the same (`UTC` and `Etc/UTC` on every host; an IANA link such as `Europe/Kiev` and `Europe/Kyiv` where the host resolves it, which Safari 27 without `Temporal` does not).
- Returns [] for invalid inputs, mismatched timezones, start &gt; end, or invalid step.
- A range holding more dates than `options.maxPieces` returns `[]` without generating any.
- An explicit `undefined` `stepDays` is the default step, so `(start, end, undefined, options)` reaches `options`. **Compatibility:** before 1.16.0 it returned `[]`.
- **End-inclusive, where the `interval*` functions are half-open.** This enumerates the dates a range covers, so the end date is one of them; an interval bounds a span as `[start, end)`, so its `end` is not. The same pair therefore yields one more date here than `intervalCountZoned` counts.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `startZonedDateTime` | `string` | start zoned ISO 8601 datetime string |
| `endZonedDateTime` | `string` | end zoned ISO 8601 datetime string |
| `stepDays` | `number` | optional positive integer step in days |

## Options

**options**

optional limit on the size of the output

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `maxPieces?` | `number` | `1_000_000` | The most dates the result may hold. A result that would hold more, or more than the longest possible array (2^32 - 1 elements), returns `[]` and none is built. A value that is not a positive safe integer also returns `[]`. |

## Returns

array of ISO date strings or [] when invalid

## Examples

```ts
import { mapZonedDatesInRange } from "@northguild/gmt/zoned/map";

mapZonedDatesInRange("+275760-09-12T00:00:00+00:00[UTC]", "+275760-09-13T00:00:00+00:00[UTC]") // ["+275760-09-12", "+275760-09-13"] (a range ending on the maximum instant)
```

## Source

[zoned/map/mapZonedDatesInRange.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/zoned/map/mapZonedDatesInRange.ts)
