---
title: isoDate
description: Creates an ISO date validation action.
source: /actions/isoDate/isoDate.ts
contributors:
  - fabian-hiller
---

import { ApiList, Property } from '~/components';
import { properties } from './properties';

# isoDate

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` <Property {...properties.TInput} />
- `TMessage` <Property {...properties.TMessage} />

## Parameters

- `message` <Property {...properties.message} />

### 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` <Property {...properties.Action} />

## 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

<ApiList items={['any', 'custom', 'string']} />

### Methods

<ApiList items={['pipe']} />

### Utils

<ApiList items={['isOfKind', 'isOfType']} />
