Skip to content

Latest commit

 

History

History
54 lines (32 loc) · 1.25 KB

README.md

File metadata and controls

54 lines (32 loc) · 1.25 KB

ExTimezoneDB

Travis: Travis CI Build Status

ExTimezoneDB is a simple interface to the TimeZoneDB REST API

Currently, only three functions are available:

  • get_timezone_by_name Which is used to find timezone information by name(ie "America/New_York")
  • get_timezone_by_position Which is used to find timezone information by latitude and longitude
  • get_timezone_by_city Which is used to find timezone(s) by using the name of the city. Potentially returns mutliple time zones.

Installation

Add ExTimezoneDB to your mix.exs:

  
  defp deps do
    [
      {:ex_timezone_db, github: "r11132a/ex_timezone_db", branch: "master"}
    ]

Dependencies

ExTimezoneDB relies on HTTPoison and Poison for http requests and json parsing, respectivly.

Usage

In config.exs

  
  config :ex_timezone_db,api_key: YOUR_API_KEY

The following is optional (defaults to false), but should be set if you have a Premium key (value is a boolean)

  config :ex_timezone_db, premium: true

In your code:

  {:ok,timezone_info} = ExTimezoneDB.get_timezone_by_name("America/New_York")