DurationSchema
const DurationSchema: GenericSchema<string, string>;Defined in: temporal-schemas.ts:155
valibot schema for an ISO-8601 duration (PT30M, P1DT2H). Validated with
Temporal.Duration.from and normalized to the canonical string. Output is a
string, not a Temporal.Duration.
Example
Section titled “Example”import * as v from "valibot";import { DurationSchema } from "@xtandard/lib/valibot";
const MeetingSchema = v.object({ length: DurationSchema });
v.parse(MeetingSchema, { length: "PT90M" }); // { length: "PT90M" }v.safeParse(DurationSchema, "15 minutes").issues?.[0].message;// "Invalid duration (expected ISO-8601 like PT30M)"