* Validate that a timezone string is recognised by the runtime. * Returns true if valid, false otherwise.
(tz: string)
| 63 | // --------------------------------------------------------------------------- |
| 64 | |
| 65 | /** |
| 66 | * Validate that a timezone string is recognised by the runtime. |
| 67 | * Returns true if valid, false otherwise. |
| 68 | */ |
| 69 | function isValidTimezone(tz: string): boolean { |
| 70 | try { |
| 71 | Intl.DateTimeFormat(undefined, { timeZone: tz }); |
| 72 | return true; |
| 73 | } catch { |
| 74 | return false; |
| 75 | } |