Skip to content

Latest commit

 

History

3 提交

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

仓库 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.

关于

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

Resources

Stars

1 star

关注者

1 watching

复刻s

发布

贡献者

Languages