parseTimeZone
function parseTimeZone(input): TimeZone;Defined in: valibot-utils.ts:41
Parse an unknown value as a TimeZone, throwing when it isn’t a valid
IANA id. Shorthand for v.parse(TimeZoneSchema, input).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
unknown |
Returns
Section titled “Returns”Throws
Section titled “Throws”When input isn’t a string or isn’t a valid time zone.
Example
Section titled “Example”import { parseTimeZone } from "@xtandard/lib/valibot";
parseTimeZone("Europe/Berlin"); // "Europe/Berlin" (TimeZone)parseTimeZone("Mars/Olympus"); // throws ValiError: Invalid IANA time zone