Skip to content

An Elixir wrapper for the holiday API Calendarific

License

Notifications You must be signed in to change notification settings

Bounceapp/elixir-calendarific

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calendarific for Elixir Hex pm hex.pm downloads

An Elixir wrapper for the holiday API Calendarific (https://calendarific.com/)

Installation

This package can be installed by adding calendarific to your list of dependencies in mix.exs:

def deps do
  [
    {:calendarific, "~> 0.1.4"}
  ]
end

Configuration

To make calls to Calendarific, it is necessary to configure your Calendarific API Key on your config.exs file:

config :calendarific, api_key: System.get_env("CALENDARIFIC_API_KEY")
# OR
config :calendarific, api_key: "YOUR API KEY"

Examples

Holidays

To fetch holidays for a given country and year, you can use the holidays/2 method:

iex> Calendarific.holidays(country: "US", year: 2021)
[
  %Calendarific.Types.Holiday{
    country: %Calendarific.Types.Country{id: "us", name: "United States"},
    date: %Calendarific.Types.Date{
      datetime: %Calendarific.Types.DateTime{day: 1, month: 1, year: 2021},
      iso: "2021-01-01"
    },
    description: "New Year's Day is the first day of the Gregorian calendar, which is widely used in many countries such as the USA.",
    locations: "All",
    name: "New Year's Day",
    states: "All",
    type: ["National holiday"]
  },
  ...
]

Documentation

The docs can be found at https://hexdocs.pm/calendarific.

License

More info at LICENSE.

About

An Elixir wrapper for the holiday API Calendarific

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages