View Source Holidefs.DateCalculator (holidefs v0.4.0)

Some functions to calculate dynamic holiday dates.

Link to this section Summary

Functions

Returns the first day of the given month on the given year.

Returns the date of Easter for the given year.

Returns the date of Orthodox Easter for the given year.

Returns the date of Orthodox Easter for the given year.

Returns the next day of week after the given day.

Returns the nth day of the week.

Returns the previous day of week after the given day.

Link to this section Functions

Link to this function

beginning_of_month(year, month)

View Source

Specs

beginning_of_month(integer(), integer()) :: Date.t()

Returns the first day of the given month on the given year.

Specs

gregorian_easter(integer()) :: Date.t()

Returns the date of Easter for the given year.

examples

Examples

iex> Holidefs.DateCalculator.gregorian_easter(2016)
~D[2016-03-27]

iex> Holidefs.DateCalculator.gregorian_easter(2015)
~D[2015-04-05]
Link to this function

gregorian_orthodox_easter(year)

View Source

Specs

gregorian_orthodox_easter(integer()) :: Date.t()

Returns the date of Orthodox Easter for the given year.

examples

Examples

iex> Holidefs.DateCalculator.gregorian_orthodox_easter(2016)
~D[2016-05-01]

iex> Holidefs.DateCalculator.gregorian_orthodox_easter(2015)
~D[2015-04-12]
Link to this function

julian_orthodox_easter(year)

View Source

Specs

julian_orthodox_easter(integer()) :: Date.t()

Returns the date of Orthodox Easter for the given year.

examples

Examples

iex> Holidefs.DateCalculator.julian_orthodox_easter(2016)
~D[2016-04-18]

iex> Holidefs.DateCalculator.julian_orthodox_easter(2015)
~D[2015-03-30]
Link to this function

next_day_of_week(date, day_of_week)

View Source

Specs

next_day_of_week(Date.t(), integer()) :: Date.t()

Returns the next day of week after the given day.

Link to this function

nth_day_of_week(year, month, week, weekday)

View Source

Specs

nth_day_of_week(integer(), integer(), integer(), integer()) :: Date.t()

Returns the nth day of the week.

Link to this function

previous_day_of_week(date, day_of_week)

View Source

Specs

previous_day_of_week(Date.t(), integer()) :: Date.t()

Returns the previous day of week after the given day.