timeZoneLike
const timeZoneLike: RegExp = /^(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?|[A-Za-z._][A-Za-z0-9._+-]*(?:\/[A-Za-z._][A-Za-z0-9._+-]*)*)$/;RegExp matching the shape of a time zone identifier: Temporal’s TimeZoneIdentifier grammar (§13.31, the ISO 8601 / RFC 9557 grammar), TimeZoneIdentifier ::: UTCOffset[~SubMinutePrecision] | TimeZoneIANAName.
Examples
Section titled “Examples”import { timeZoneLike } from "@northguild/gmt";timeZoneLike.test("UTC") // truetimeZoneLike.test("America/New_York") // truetimeZoneLike.test("Japan") // true (single-component IANA link)timeZoneLike.test("Etc/GMT+5") // truetimeZoneLike.test("Custom/Zone") // true (shape only; existence is not checked)timeZoneLike.test("+05:00") // true (an offset identifier)timeZoneLike.test("-0800") // true (a basic-format offset identifier)timeZoneLike.test("+05:00:00") // false (no seconds in an offset identifier)timeZoneLike.test("-foo/bar") // false (a name cannot start with - or +)timeZoneLike.test("UTC+05:00") // false (":" is not a name character)