View Source Zonex (Zonex v0.6.0)
Zonex is a library for compiling enriched time zone information.
Link to this section Summary
Functions
Gets a zone for a given IANA time zone name and raises if not found.
Gets a zone for a given IANA time zone name.
Determines if a zone name is legacy.
Lists all canonical time zones from the IANA database.
Link to this section Functions
@spec get_canonical!( zone_name :: String.t(), instant :: DateTime.t(), opts :: Keyword.t() ) :: Zonex.Zone.t() | no_return()
Gets a zone for a given IANA time zone name and raises if not found.
If the time zone is an alias (not canonical), the canonical zone will be returned instead.
Since names and UTC offsets vary depending on time of year
(due to daylight saving time), you need to specify the instant
at which the time zone should be expressed.
options
Options
:locale
is any locale or locale name validated byCldr.validate_locale/2
. The default isCldr.get_locale()
which returns the locale set for the current process
@spec get_canonical( zone_name :: String.t(), instant :: DateTime.t(), opts :: Keyword.t() ) :: {:ok, Zonex.Zone.t()} | {:error, :zone_not_found}
Gets a zone for a given IANA time zone name.
If the time zone is an alias (not canonical), the canonical zone will be returned instead.
Since names and UTC offsets vary depending on time of year
(due to daylight saving time), you need to specify the instant
at which the time zone should be expressed.
options
Options
:locale
is any locale or locale name validated byCldr.validate_locale/2
. The default isCldr.get_locale()
which returns the locale set for the current process
@spec legacy?(zone_name :: Calendar.time_zone()) :: boolean()
Determines if a zone name is legacy.
iex> Zonex.legacy?("America/Chicago")
false
iex> Zonex.legacy?("WET")
true
@spec list_canonical(instant :: DateTime.t(), opts :: Keyword.t()) :: [Zonex.Zone.t()]
Lists all canonical time zones from the IANA database.
Since names and UTC offsets vary depending on time of year
(due to daylight saving time), you need to specify the instant
at which the time zone should be expressed.
options
Options
:locale
is any locale or locale name validated byCldr.validate_locale/2
. The default isCldr.get_locale()
which returns the locale set for the current process