# ISO date sort

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

Stable-sort an array of YYYY-MM-DD calendar dates.

**Use when you need to: iso date sort · sort calendar dates · order dates.**

## Supported

- iso date sort
- sort calendar dates
- order dates

## Not supported

- locale collation
- datetime sort
- timezones
- deduplication

## Behavior

- dates is an array of strict YYYY-MM-DD proleptic Gregorian UTC calendar dates with year 0001-9999, at most 10000 items.
- order is "asc" (default) or "desc". Unknown order values are rejected.
- Sorting is by civil day serial. Equal dates keep their original relative order (stable sort). Duplicates are preserved, not removed.

## Input

- `dates` (array of string, required): max items 10000; each min length 10; each max length 10; each pattern `^\d{4}-\d{2}-\d{2}$`
- `order` (one of "asc", "desc", optional)

## Output

- `dates` (array of string, required): each min length 10; each max length 10

## Limits

- max items: 10000
- year min: 1
- year max: 9999

## Example

Request input:

```json
{
  "dates": [
    "2026-03-01",
    "2026-01-01",
    "2026-02-01"
  ]
}
```

Response:

```json
{
  "result": {
    "dates": [
      "2026-01-01",
      "2026-02-01",
      "2026-03-01"
    ]
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "iso-date-sort",
  "version": "1.0.0",
  "input": {
    "dates": [
      "2026-03-01",
      "2026-01-01",
      "2026-02-01"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/iso-date-sort/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"dates":["2026-03-01","2026-01-01","2026-02-01"]}'
```

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

### CLI

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

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

## Related tools

- [ISO date age](/tools/iso-date-age): Compute the calendar-aware elapsed years, months, and days between a birth date and an as-of date.
- [ISO date quarter bounds](/tools/iso-date-quarter-bounds): Return the calendar quarter number and the first/last dates of the quarter containing a date.
- [ISO date add months](/tools/iso-date-add-months): Add a signed month count to a YYYY-MM-DD date, clamping the day to the target month.
- [ISO date add years](/tools/iso-date-add-years): Add a signed whole-year delta to a YYYY-MM-DD date, clamping the day if 29 February has no match.
- [ISO date business days count](/tools/iso-date-business-days-count): Count the business days in an inclusive date range, skipping caller-supplied weekend weekdays and holidays.
- [ISO date compare](/tools/iso-date-compare): Compare two YYYY-MM-DD calendar dates and return -1, 0, or 1.
