isValidTimeZone
Playground
call
result
Signature
Section titled “Signature”isValidTimeZone(timeZone: string): booleanimport { isValidTimeZone } from "@northguild/gmt/zoned/validate";Validate whether a string is a valid IANA timeZone identifier.
- Uses Temporal.ZonedDateTime.from to test timezone validity.
- Uses regex to check format.
- Returns false for invalid timezone formats.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
timeZone |
string |
timeZone identifier to validate |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”isValidTimeZone("America/New_York") // trueisValidTimeZone("Europe/London") // trueisValidTimeZone("Invalid/Timezone") // false