TimeZoneSchema
const TimeZoneSchema: ZodPipe<ZodString, ZodTransform<TimeZone, string>>;Defined in: zod-utils.ts:20
Zod schema: validate an IANA id and brand it as TimeZone. Fails with
the issue message "Invalid IANA time zone". The value is not canonicalized.
Example
Section titled “Example”import { z } from "zod";import { TimeZoneSchema } from "@xtandard/lib/zod";
const SettingsSchema = z.object({ timeZone: TimeZoneSchema });
SettingsSchema.parse({ timeZone: "Asia/Tokyo" }); // { timeZone: "Asia/Tokyo" }TimeZoneSchema.safeParse("Mars/Olympus").error?.issues[0]?.message; // "Invalid IANA time zone"