module
JosieHealth::Utils::Timezone
Defined in:
timezone.crConstant Summary
-
ALIASES =
{"cet" => "Europe/Berlin", "cest" => "Europe/Berlin", "wet" => "Europe/London", "gmt" => "Europe/London", "bst" => "Europe/London", "eet" => "Europe/Helsinki", "eest" => "Europe/Helsinki", "est" => "America/New_York", "edt" => "America/New_York", "cst" => "America/Chicago", "cdt" => "America/Chicago", "mst" => "America/Denver", "mdt" => "America/Denver", "pst" => "America/Los_Angeles", "pdt" => "America/Los_Angeles", "jst" => "Asia/Tokyo", "kst" => "Asia/Seoul", "cst8" => "Asia/Shanghai", "hkt" => "Asia/Hong_Kong", "ist" => "Asia/Kolkata", "aest" => "Australia/Sydney", "aedt" => "Australia/Sydney", "awst" => "Australia/Perth", "nzst" => "Pacific/Auckland", "nzdt" => "Pacific/Auckland", "utc" => "UTC", "z" => "UTC"} -
Common timezone abbreviation aliases -> IANA timezone names
Class Method Summary
-
.alias?(input : String) : Bool
Check if input is a known timezone alias
-
.all_aliases : Array(String)
All known timezone aliases
-
.current_offset(tz : String) : String
Get current UTC offset string for a timezone
-
.format_offset(sign : String, hours : Int32, minutes : Int32) : String
Format offset as string (e.g., "+02:00")
-
.parse_offset(input : String) : NamedTuple(sign: String, hours: Int32, minutes: Int32) | Nil
Parse UTC offset format (+02:00, -05:00, +2, -5) Returns tuple of (sign, hours, minutes) or nil if invalid
-
.resolve_alias(input : String) : String | Nil
Resolve timezone abbreviation to IANA name Returns nil if not a known alias
-
.valid_iana?(input : String) : Bool
Validate if input is a valid IANA timezone name
Class Method Detail
Format offset as string (e.g., "+02:00")
def self.parse_offset(input : String) : NamedTuple(sign: String, hours: Int32, minutes: Int32) | Nil
#
Parse UTC offset format (+02:00, -05:00, +2, -5) Returns tuple of (sign, hours, minutes) or nil if invalid
def self.resolve_alias(input : String) : String | Nil
#
Resolve timezone abbreviation to IANA name Returns nil if not a known alias