easter

Search:
Group by:
Source   Edit  

The function of this module returns the Gregorian Easter Sunday of the year given to it as a parameter.

This calculation engine is useful because the day of Easter varies from year to year (unlike Christmas, for example, which is always December 25th).

From a historical point of view, the Gregorian calendar came into effect on October 15th, 1582. The Gregorian Easter day therefore only makes sense from the year 1583.

Procs

func gregorianEasterSundayMMDD(year: int): Option[
    tuple[month: int, monthday: int]] {....raises: [], tags: [], forbids: [].}
Returns:
  • The date of Gregorian Easter Sunday of the year given in parameter if year >= 1583.
  • none((int, int)) if year < 1583.

Algorithm:

Notes:

The results provided by this procedure have been successfully compared to the 518 Gregorian Easter days of the years 1583 to 2100. These Gregorian Easter days can be viewed here:

Example:

doAssert:  gregorianEasterSundayMMDD(1200).isNone
doAssert:  gregorianEasterSundayMMDD(1582).isNone
doAssert:  gregorianEasterSundayMMDD(2000).get == (month: 4, monthday: 23)
doAssert:  gregorianEasterSundayMMDD(2018).get == (month: 4, monthday: 1) 
doAssert:  gregorianEasterSundayMMDD(2036).get == (month: 4, monthday: 13)
doAssert:  gregorianEasterSundayMMDD(2054).get == (month: 3, monthday: 29)
doAssert:  gregorianEasterSundayMMDD(2071).get == (month: 4, monthday: 19) 
doAssert:  gregorianEasterSundayMMDD(2097).get == (month: 3, monthday: 31)
Source   Edit