parseTimeZone
function parseTimeZone(input): TimeZone;Defined in: arktype-utils.ts:42
Parse an unknown value as a TimeZone, throwing when it isn’t a valid
IANA id. Shorthand for TimeZoneSchema.assert(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/arktype";
parseTimeZone("Asia/Tokyo"); // "Asia/Tokyo" (TimeZone)parseTimeZone("Mars/Olympus");// throws TraversalError: must be valid according to an anonymous predicate (was "Mars/Olympus")