Skip to content

isValidTimeZone

function isValidTimeZone(input): object;

Defined in: timezone.ts:33

Whether timeZone is a valid IANA id (constructing Intl.DateTimeFormat throws for unknown zones). Dependency-free; every TimeZoneSchema runs it.

Validity follows the runtime’s Intl data, so Intl’s looser inputs pass too ("utc", "EST", offsets like "+05:00"), and the id is not canonicalized.

Parameter Type
input { timeZone: string; }
input.timeZone string

object

Name Type Defined in
valid boolean timezone.ts:33
import { isValidTimeZone } from "@xtandard/lib/valibot"; // also /zod, /arktype, /effect
isValidTimeZone({ timeZone: "Europe/Paris" }); // { valid: true }
isValidTimeZone({ timeZone: "Mars/Olympus" }); // { valid: false }
isValidTimeZone({ timeZone: "utc" }); // { valid: true }