Skip to content

PlainDateSchema

const PlainDateSchema: GenericSchema<string, string>;

Defined in: temporal-schemas.ts:70

valibot schema for a calendar date YYYY-MM-DD. Validated with Temporal.PlainDate.from (so impossible dates fail) and normalized to the canonical string. Output is a string, not a Temporal.PlainDate.

import * as v from "valibot";
import { PlainDateSchema } from "@xtandard/lib/valibot";
v.parse(PlainDateSchema, "2026-12-25"); // "2026-12-25"
v.parse(PlainDateSchema, "2026-12-25T09:00"); // "2026-12-25" (time dropped)
v.safeParse(PlainDateSchema, "2026-02-30").issues?.[0].message;
// "Invalid plain date (expected YYYY-MM-DD)"