Skip to content

Date

Example

import * as p from '@vbudovski/paseri';
const schema = p.date();
const data = new Date(2020, 0, 1);
const result = schema.safeParse(data);
if (result.ok) {
// result.value typed as `Date`.
}

Playground

Schema
Data
Result

Validators

min

Date on or after value.

p.string().min(new Date(2020, 0, 1));

max

Date on or before value.

p.string().max(new Date(2020, 0, 1));