Calculating Easter

Calculating Easter

Abstract: Call one of the attached transformations as a subtransformation in your main transformation to calculate Easter sunday for any give year in the Gregorian calendar. From there you can easily calculate a host of widely observed christian holidays. This may be useful for loading holiday attributes in a date dimension.

Authors: Roland Bouman, Matt Casters

License: LGPL

Kettle versions: 3.2.0 and up (see Attachments section for more detailed info)

Attachments

Download all

Background

For a wide range of use cases, a date dimension that keeps track of holidays is a valuable asset. Many countries observe Christian holidays, so it would be really nice to have a generic solution to pre-calculate all Christian holidays.

The most well known Christian holidays are Christmas and Easter. Keeping track of Christmas is trivial, as Christmas day (and thus, Christmas eve) occur always on the same date. Easter on the other hand does not occur on the same date. In addition to Easter itself, there are a number of holidays that occur at a fixed number of days before and after Easter, such as:

  • Good Friday (2 days before Easter)
  • Maundy Thursday (3 days before Easter)
  • Holy Wednesday (4 days before Easter)
  • Palm Sunday (7 days before Easter)
  • Ascension (40 days after Easter)
  • Pentecost (50 days after Easter)

The list is not exhaustive. Days like Trinity Sunday, Corpus Christi, Ash Wednesday are also related via a fixed interval to Easter sunday.
There are a number of algorithms available tot calculate Easter sunday. For more general information on the subject, see: http://en.wikipedia.org/wiki/Computus
In the attachement, two reusable transformations are offered that can be used to calculate Easter sunday for a give year. One uses the kettle JavaScript step and is compatible with Kettle 3.2.0 and up, the other uses the User-defined Java Class step and is compatible with kettle 4.0.1. Both transformations can be used as a subtransformation. There's also a transformation attached that shows exactly how to call the transformations as a subtransformation.

See Also: