Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to return a date of the Catholic calendar #107

Open
19 tasks
Seddryck opened this issue Dec 20, 2022 · 0 comments
Open
19 tasks

Function to return a date of the Catholic calendar #107

Seddryck opened this issue Dec 20, 2022 · 0 comments
Labels
new-feature Request for a new feature in the tool

Comments

@Seddryck
Copy link
Owner

Seddryck commented Dec 20, 2022

The function calendar-catholic(event) is accepting an argument defining the event of the Christian calendar. It returns the date of the event for the year specified in the argument. The name of the event is not case-sensitive. If the event is not defined (out of the list defined below), the function returns null.

2023 | calendar-catholic("Christmas")
=> 2023-12-25

2023 | calendar-catholic("Easter Sunday")
=> 2023-04-09

2023 | calendar-catholic("Corpus Christi")
=> 2023-06-08

2023 | calendar-catholic("First Sunday of Advent")
=> 2023-12-03

2022 | calendar-catholic("First Sunday of Advent")
=> 2022-11-27
  • Epiphany: 6th of January
  • Candlemas: 2nd of February
  • The Annunciation: 25th of March
  • Shrove Tuesday: 46 days before Easter Sunday (is a Tuesday)
  • Ash Wednesday: 45 days before Easter Sunday (is a Wednesday)
  • Palm Sunday: 7 days before Easter Sunday (is a Sunday)
  • Maundy Thursday: 3 days before Easter Sunday (is a Thursday)
  • Good Friday: 2 days before Easter Sunday (is a Friday)
  • Easter Sunday: See calculation below (is a Sunday)
  • Ascension Day: 39 days after Easter Sunday (is a Thursday)
  • Pentecost (alias Whit Sunday): 49 days after Easter Sunday (is a Sunday)
  • Whit Monday: 50 days after Easter Sunday (is a Monday)
  • Trinity Sunday: 56 days after Easter Sunday (is a Sunday)
  • Corpus Christi: 61 days after Easter Sunday (is a Thursday)
  • The Assumption: 15th of August
  • Immaculate Conception: 8th of September
  • All Saints’ Day: 1st of November
  • First Sunday of Advent: 4 Sundays before Christmas (is a Sunday)
  • Christmas: 25th of December

The function to calculate Easter is defined here and documented at https://www.tondering.dk/claus/cal/easter.php

private static DateTime Easter(int year) {
    int a = year%19;
    int b = year/100;
    int c = (b - (b/4) - ((8*b + 13)/25) + (19*a) + 15)%30;
    int d = c - (c/28)*(1 - (c/28)*(29/(c + 1))*((21 - a)/11));
    int e = d - ((year + (year/4) + d + 2 - b + (b/4))%7);
    int month = 3 + ((e + 40)/44);
    int day = e + 28 - (31*(month/4));
    return new DateTime(year, month , day);
}
@Seddryck Seddryck added the new-feature Request for a new feature in the tool label Dec 20, 2022
@Seddryck Seddryck changed the title Function to return a date of the Christian calendar Function to return a date of the Catholic calendar Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature Request for a new feature in the tool
Projects
None yet
Development

No branches or pull requests

1 participant