WhereTZ v0.1.10 WhereTZ View Source

WhereTZ is Elixir version of Ruby gem for lookup of timezone by georgraphic coordinates.

Example

iex(1)> WhereTZ.lookup(50.004444, 36.231389)  
"Europe/Kiev"

iex(2)> WhereTZ.get(50.004444, 36.231389)   
#<TimezoneInfo(Europe/Kiev - EET (+02:00:00))>

Link to this section Summary

Functions

Timex.TimezoneInfo object by coordinates.

Time zone name by coordinates.

Link to this section Functions

Link to this function

get(lat, lng)

View Source
get(-90..90, -180..180) :: Timex.TimezoneInfo.t() | nil

Timex.TimezoneInfo object by coordinates.

  • lat Latitude (floating point number)
  • lng Longitude (floating point number)

@return Timex.TimezoneInfo

Example

iex(1)> WhereTZ.get(50.004444, 36.231389)   
#<TimezoneInfo(Europe/Kiev - EET (+02:00:00))>
Link to this function

lookup(lat, lng)

View Source
lookup(-90..90, -180..180) :: String.t() | nil

Time zone name by coordinates.

  • lat Latitude (floating point number)
  • lng Longitude (floating point number)

@return {String, nil, Array} time zone name, or nil if no time zone corresponds to (lat, lng); in rare (yet existing) cases of ambiguous timezones may return an array of names

Example

iex(1)> WhereTZ.lookup(50.004444, 36.231389)  
"Europe/Kiev"