Timezone in various formats
Valid Zone instance, or undefined if invalid
// Numbers (offset in minutes)
normalizeZone(480)?.name // "UTC+8"
normalizeZone(-300)?.name // "UTC-5"
normalizeZone(0)?.name // "UTC"
// ISO offset strings
normalizeZone("+08:00")?.name // "UTC+8"
normalizeZone("-05:30")?.name // "UTC-5:30"
normalizeZone("UTC+7")?.name // "UTC+7"
// IANA timezone names
normalizeZone("America/Los_Angeles")?.name // "America/Los_Angeles"
normalizeZone("Asia/Tokyo")?.name // "Asia/Tokyo"
// UTC aliases
normalizeZone("UTC")?.name // "UTC"
normalizeZone("GMT")?.name // "UTC"
normalizeZone("Z")?.name // "UTC"
normalizeZone("Zulu")?.name // "UTC"
// Invalid inputs return undefined
normalizeZone("invalid") // undefined
normalizeZone("+25:00") // undefined (beyond ±14 hours)
normalizeZone(1200) // undefined (20 hours, beyond ±14 hours)
normalizeZone(100) // undefined (not a valid timezone offset)
normalizeZone(-1) // undefined (UnsetZone sentinel)
normalizeZone(null) // undefined
Normalize a timezone input to a valid Luxon Zone.
Accepts multiple input formats and returns a validated Zone instance, or undefined if the input cannot be normalized to a valid timezone.
Supported input formats:
The function respects Settings: