Skip to content

Simple library to get the date of Easter for a given year.

License

Notifications You must be signed in to change notification settings

Splagoon/easter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easter

hex.pm version

The Easter module adds functions to get the date of Easter for a given year. It's more complicated than you might think! This module uses the algorithm described here.

Installation

Easter is available in Hex. The package can be installed by adding easter to your list of dependencies in mix.exs:

def deps do
  [
    {:easter, "~> 1.0.0"}
  ]
end

Usage

To get the date of Easter for a given year, use Easter.get_date:

iex> Easter.get_date(2023)
{:ok, ~D[2023-04-09]}

If the year is outside of the Calendar.ISO valid range (-9999 to 9999), an error will be returned:

iex> Easter.get_date(10_000)
{:error, :invalid_date}

There is also Easter.get_date! if you want it to raise an exception instead.

Full documentation is available on HexDocs.

About

Simple library to get the date of Easter for a given year.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages