Validates datetime inputs and normalizes them to Date objects.
Accepts:
Rejects epoch numbers, date-only strings, and other loose inputs.
Composable with .optional(), .nullable(), etc. at the call site:
.optional()
.nullable()
z.object({ start: dateTimeSchema(), clockIn: dateTimeSchema().optional(),}); Copy
z.object({ start: dateTimeSchema(), clockIn: dateTimeSchema().optional(),});
z.input → string | Date z.output → Date
Validates datetime inputs and normalizes them to Date objects.
Accepts:
Rejects epoch numbers, date-only strings, and other loose inputs.
Composable with
.optional(),.nullable(), etc. at the call site:z.input → string | Date z.output → Date