Skip to content

isValidTimeZone

Playground

call
result 
isValidTimeZone(timeZone: string): boolean
import { 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.
Parameter Type Description
timeZone string timeZone identifier to validate

boolean indicating validity

isValidTimeZone("America/New_York") // true
isValidTimeZone("Europe/London") // true
isValidTimeZone("Invalid/Timezone") // false

zoned/validate/isValidTimeZone.ts