View Source Cldr.Timezone (Cldr v2.37.2)
Functions to map between the CLDR short time zone code and the IANA timezone names.
The Unicode locale extension U allows the specification of the time zone requested for the provided locale.
This short timezone codes never change even if the IANA names change over time. Therefore these short codes are always stable between CLDR releases.
Link to this section Summary
Functions
Returns a :{:ok, list}
where list is a
list of IANA timezone names for
a given CLDR short zone code. If no such
short code exists then :error
is returned.
Returns a list of IANA time zone names for
a given CLDR short zone code, or nil
Returns a mapping of CLDR short zone codes to IANA timezone names.
Returns a mapping of territories to their known IANA timezone names.
Link to this section Functions
Returns a :{:ok, list}
where list is a
list of IANA timezone names for
a given CLDR short zone code. If no such
short code exists then :error
is returned.
example
Example
iex> Cldr.Timezone.fetch("ausyd")
{:ok,
["Australia/Sydney", "Australia/ACT", "Australia/Canberra", "Australia/NSW"]}
iex> Cldr.Timezone.fetch("nope")
:error
Returns a list of IANA time zone names for
a given CLDR short zone code, or nil
examples
Examples
iex> Cldr.Timezone.fetch("ausyd")
["Australia/Sydney", "Australia/ACT", "Australia/Canberra", "Australia/NSW"]}
iex> Cldr.Timezone.fetch("nope")
nil
@spec timezones() :: map()
Returns a mapping of CLDR short zone codes to IANA timezone names.
@spec timezones_for_territory() :: map()
Returns a mapping of territories to their known IANA timezone names.