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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ timeZone: string; } |
input.timeZone |
string |
Returns
Section titled “Returns”object
| Name | Type | Defined in |
|---|---|---|
valid |
boolean |
timezone.ts:33 |
Example
Section titled “Example”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 }