# ISO date clamp

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

Clamp a YYYY-MM-DD calendar date into an inclusive [min, max] range.

**Use when you need to: iso date clamp · bound date to range · restrict date to min max.**

## Supported

- iso date clamp
- bound date to range
- restrict date to min max

## Not supported

- datetime input
- timezones
- open ranges

## Behavior

- date, min, and max are strict YYYY-MM-DD proleptic Gregorian UTC calendar dates with year 0001-9999.
- min must not be after max, or the call is rejected.
- If date is before min, the result is min. If date is after max, the result is max. Otherwise the result is date unchanged.

## Input

- `date` (string, required): min length 10; max length 10; pattern `^\d{4}-\d{2}-\d{2}$`
- `min` (string, required): min length 10; max length 10; pattern `^\d{4}-\d{2}-\d{2}$`
- `max` (string, required): min length 10; max length 10; pattern `^\d{4}-\d{2}-\d{2}$`

## Output

- `date` (string, required): min length 10; max length 10

## Limits

- year min: 1
- year max: 9999

## Example

Request input:

```json
{
  "date": "2026-01-01",
  "min": "2026-02-01",
  "max": "2026-03-01"
}
```

Response:

```json
{
  "result": {
    "date": "2026-02-01"
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "iso-date-clamp",
  "version": "1.0.0",
  "input": {
    "date": "2026-01-01",
    "min": "2026-02-01",
    "max": "2026-03-01"
  }
}
```

### HTTP (no key)

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

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

### CLI

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

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

## Related tools

- [ISO date-time clamp](/tools/iso-datetime-clamp): Clamp a strict UTC ISO-8601 datetime into an inclusive [min, max] range.
- [ISO date min max](/tools/iso-date-min-max): Return the earliest and latest date in a non-empty array of YYYY-MM-DD calendar dates.
- [ISO date add](/tools/iso-date-add): Add a signed whole-day delta to a strict YYYY-MM-DD calendar 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 day add](/tools/iso-date-business-day-add): Add a signed count of business days to a date, skipping caller-supplied weekend weekdays and holidays.
