# isoDate

> This document is the Markdown version of [valibot.dev/api/isoDate/](https://valibot.dev/api/isoDate/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates an [ISO date](https://en.wikipedia.org/wiki/ISO_8601) validation action.

Format: `yyyy-mm-dd`

> The regex used cannot validate the maximum number of days based on year and month. For example, "2023-06-31" is valid although June has only 30 days.

```ts
const Action = v.isoDate<TInput, TMessage>(message);
```

## Generics

- `TInput` `extends string`
- `TMessage` `extends ErrorMessage<IsoDateIssue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `isoDate` you can validate the formatting of a string. If the input is not an ISO date, you can use `message` to customize the error message.

## Returns

- `Action` `IsoDateAction<TInput, TMessage>`

## Examples

The following examples show how `isoDate` can be used.

### ISO date schema

Schema to validate an ISO date.

```ts
const IsoDateSchema = v.pipe(
  v.string(),
  v.isoDate('The date is badly formatted.')
);
```

### Minimum value schema

Schema to validate an ISO date is after a certain date.

```ts
const MinValueSchema = v.pipe(
  v.string(),
  v.isoDate(),
  v.minValue('2000-01-01', 'The date must be after the year 1999.')
);
```

## Related

The following APIs can be combined with `isoDate`.

### Schemas

[`any`](/api/any.md), [`custom`](/api/custom.md), [`string`](/api/string.md)

### Methods

[`pipe`](/api/pipe.md)

### Utils

[`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)
