# ISO date range union

`iso-date-range-union` · version 1.0.0 · Dates & times (UTC, ISO 8601) · free, no key needed

Merge overlapping or day-adjacent inclusive [start, end] date ranges into the fewest equivalent ranges.

**Use when you need to: iso date range union · merge date ranges · combine overlapping date periods.**

## Supported

- iso date range union
- merge date ranges
- combine overlapping date periods

## Not supported

- open ranges
- timezones
- datetime ranges

## Behavior

- ranges is an array of 1-1000 inclusive [start, end] YYYY-MM-DD date ranges with year 0001-9999; start must not be after end in any entry.
- Two ranges merge when they overlap or are day-adjacent (one starts the calendar day immediately after the other ends).
- union is the sorted, non-overlapping, non-adjacent set of merged ranges covering exactly the same days as the input, ascending by start.

## Input

- `ranges` (array of object, required): min items 1; max items 1000

## Output

- `union` (array of object, required)

## Limits

- year min: 1
- year max: 9999
- max ranges: 1000

## Example

Request input:

```json
{
  "ranges": [
    {
      "start": "2026-01-01",
      "end": "2026-01-05"
    },
    {
      "start": "2026-01-06",
      "end": "2026-01-10"
    },
    {
      "start": "2026-02-01",
      "end": "2026-02-05"
    }
  ]
}
```

Response:

```json
{
  "result": {
    "union": [
      {
        "start": "2026-01-01",
        "end": "2026-01-10"
      },
      {
        "start": "2026-02-01",
        "end": "2026-02-05"
      }
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "iso-date-range-union",
  "version": "1.0.0",
  "input": {
    "ranges": [
      {
        "start": "2026-01-01",
        "end": "2026-01-05"
      },
      {
        "start": "2026-01-06",
        "end": "2026-01-10"
      },
      {
        "start": "2026-02-01",
        "end": "2026-02-05"
      }
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/iso-date-range-union/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"ranges":[{"start":"2026-01-01","end":"2026-01-05"},{"start":"2026-01-06","end":"2026-01-10"},{"start":"2026-02-01","end":"2026-02-05"}]}'
```

The machine-readable contract is at [/v1/tools/iso-date-range-union/versions/1.0.0](/v1/tools/iso-date-range-union/versions/1.0.0).

### CLI

```sh
node cli.mjs run iso-date-range-union 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [ISO date range intersect](/tools/iso-date-range-intersect): Compute the intersection of two inclusive [start, end] date ranges.
- [ISO date range overlap](/tools/iso-date-range-overlap): Test whether two inclusive [start, end] date ranges share at least one day.
- [ISO date range split by month](/tools/iso-date-range-split-by-month): Split an inclusive [start, end] date range into per-calendar-month sub-ranges.
- [ISO date clamp](/tools/iso-date-clamp): Clamp a YYYY-MM-DD calendar date into an inclusive [min, max] range.
- [ISO date range contains](/tools/iso-date-range-contains): Test whether an inclusive [start, end] date range contains a given date.
- [ISO date range list](/tools/iso-date-range-list): Enumerate the dates in an inclusive [start, end] range stepped by a whole number of days.
