# Talk:Holidays related to Easter

## Whose Easter?

Whose Easter are we calculating here? Or, more specifically, which calendars are we using? (And, when do we switch from Gregorian to Julian?) According to Wikipedia, depending on the answers to these questions we can have easter in March, April or May. The sample output from the Algol 68 program makes me think that we are supposed to calculate what wikipedia calls the "Western Christianity"'s Easter, but that was just one of the issues which cause different people to assign different dates to easter in the same year. I think a full specification would be appropriate here. (Easter is apparently the first sunday after the 14th of the month where it occurs, but I am confused about how you unambiguously determine which month it occurs in. But I am also having problems reconciling this "first sunday after the 14th of the month" rule with easters which occur in the first week of April.) --Rdm 14:40, 29 June 2010 (UTC)

It's the first Sunday after the 14th day of the lunar month. That is, the first Sunday after the full moon, specifically, the full moon after March 21st. --Markjreed 04:22, 4 June 2011 (UTC)
It's horribly complicated as it's usually the Sunday of the weekend after Passover, but is calculated using different rules to those specified in the Torah. And it's been the subject of a number of major fights in the Christian church (e.g., the Council of Nicaea). So I searched around and ended up using the code at the end of http://www.assa.org.au/edm.html (which I think is based on doing the switch to Gregorian rules using the British date; you should be able to confirm from the tables higher up that page) as that at least gives the same days/months as that deeply impenetrable ALGOL code for the dates in the exact challenge. –Donal Fellows 10:34, 30 June 2010 (UTC)
http://www.assa.org.au/edm.html describes several different (and apparently conflicting) methods for determining when easter is. Although the page itself claims to describe how to do this for dates from 326 onward, the code at the bottom of the page is claimed to be accurate for years 1583..4099. (Many -- but not all --european countries switched from the julian calendar to the gregorian calendar between easter in 1582 and easter in 1583.) Given the historical issues here, I think the task should explicitly specify how they are handled (or, perhaps, specify a date range which excludes the conflicts). As it stands now, implementations which do not specify multiple easters in some years necessarily fail to recognize some easters and this is complicated by the fact that the same "date" in different calendar systems will necessarily represent different physical dates. --Rdm 18:34, 30 June 2010 (UTC)

I just changed brief operators to bold operator for readability. I hope it helps.
Not sure what to do about dates before Gregorian. Esp Sep 1752. We might standardise on Common Era (CE) for the program, however even CE is vague about whether either early Gregorian calendar Or Julian calendar dates should be used.
[OT: Time.... to be the Time Lord and just play with time... I heard [an urban myth(?)] that Julius Caesar changed the first month of the year from March to the next January so as to increase his term in the Senate. Hence to this day Sep/Oct/Nov/December are no longer the 7th/8th/9th/10th months. It seems when you are the Consul/Dictator of the Roman Republic you then have enough authority to bend time! EYHO Albert!  :-) ]
NevilleDNZ 00:33, 1 July 2010 (UTC)
You're right about that being an urban myth, FYI. The numbering of the months dates from an older Roman calendar, older even than the one Julius replaced. The short-changing of February is just as old; the story of Julius and Augustus stealing days from it to make their months 31 days each is also a myth. --Markjreed 04:37, 4 June 2011 (UTC)
For example: http://www.merlyn.demon.co.uk/estrdate.htm#MEDC -- for the year 2011, easter falls on April 11 and April 24 where in the year 2000, it fell on April 17th, April 23 and April 30. And things are much simpler now than they were in the past... --Rdm 02:20, 5 July 2010 (UTC)
Well, all that I can really say for sure is that the code is probably wrong, but both the Algol and Tcl examples are wrong in the same way. (I know they're wrong because when I put in the day of the week, things are all over the place before the switch to the Gregorian calendar; that's an area where I'm pretty sure that the Tcl time formatting engine is correct; the guy who wrote the modern implementation is a serious time geek.) Given the massive uncertainty over calendars, I suggest not worrying about it. As noted, it's been a point of contention for the church for a long time even without programmers involved. –Donal Fellows 09:33, 5 July 2010 (UTC)

Not only is it horribly complicated (or rather not clear), arguments over how to do it split the church (the excommunication of the Quartodecimans which sounds like something out of Ghostbusters) and almost started conflicts. See [1] --Dgamey 22:27, 8 July 2010 (UTC)
To be fair, Easter calculation is a bit complex, but not "horribly" so, nor is it all that controversial at this point. Most of the complexity in descriptions is left over from the traditional, pre-computer methods used to calculate the date; in straightforward code, it's not that bad. As for the controversy, that was mostly settled in 325 AD. There is one remaining schism - between the Western and Eastern Orthodox congregations - and even they agree on the basic rule: Easter is the first Sunday after the first (approximated) full moon on or after March 21st. They only disagree in the choice of calendar, which leads to two discrepancies: the two calendars call different days "March 21st" (for years between 1900 and 2099, Eastern "March 21st" is the same day as Western "April 3rd"), and have slightly different rules for approximating the moon phases, so the calculated "full moon" falls on different dates between them. In 2012, Western churches will observe Easter Sunday on April 8th, but the Julian calculation places it on April 2nd, and because of the 13-day difference between the calendars, the actual date of Orthodox Easter is April 15th. --Markjreed 04:22, 4 June 2011 (UTC)

I was thinking of adding a Python calculator for future easters that relied on the random module :-)
--Paddy3118 13:07, 5 July 2010 (UTC)

## Suggestion

Take away the uncertainty. Find a routine that is easy to follow and has little controversy in calculating Easter for a small period of time around now. Quote the routine in the task description, and have the task be to calculate a less controversial number of Easters around now. You could point to external arguments about dates of Easter for the interested, but meaanwhile you would get a task that aids programming chrestomathy.

Good idea, especially if you specify the Gregorian Calendar and Catholic rules (i.e., no ambiguity from calendars or religious denominations). –Donal Fellows 22:30, 8 July 2010 (UTC)
All of the easter holiday rules are catholic rules. But some of the dates required by the current task are dates when older versions of the rules were the "officially accepted versions". I would recommend, in addition to specifying the current catholic rules and the gregorian calendar, that we also change the task's example to use years from 1990 through 2020. --Rdm 17:00, 9 July 2010 (UTC)

To take away the uncertainty, you only have to specify which set of rules. As I said above, different churches use different rules (Gregorian vs Julian), so you have to specify at least which of those you want. But having specified Gregorian, there's no need to limit it to such a narrow range of years; the Gregorian rules are valid in the Western Church as far back as the Gregorian calendar has been in use, which is of course locale-dependent, but goes back at least as far as 1929 everywhere (see wp:Gregorian Calendar#Adoption), and those rules are valid for the foreseeable future as well (though there have been proposals to abandon them in favor of a wholly astronomical calculation.) --Markjreed 03:58, 4 June 2011 (UTC)

## Inconsistency for negative years

There is an inconsistency in the results of the solutions on this page for negative years. (Yes, I know that Easter didn't exist back then, but this is just from an algorithmic perspective.) For example, for the year -1 (i.e. 2 B.C.), the C code produces an Easter date of March 27, while the Ruby code produces April 18. I believe this is due to the different behavior of the modulo operator for negative numbers. --Spoon! 23:43, 18 December 2011 (UTC)

For 2 BCE, Julian (Orthodox) Easter rules should apply, and Easter should be April 20 (Julian). But you apply Gregorian rules and use the Gregorian calendar, then April 18 is correct. (In fact, both sets of rules produce the same result in this instance, since those dates refer to the same Sunday). So the C code is incorrect in this instance. --Markjreed (talk) 03:01, 16 January 2021 (UTC)

## Description

"Eastern Orthodox Church eventually adopted the Gregorian calendar for the fixed holidays and no longer observes Christmas on its Julian date" - what? Christmas is celebrated on January 7th according to the Gregorian calendar, not December 25th. Русский (talk) 20:42, 6 March 2021 (UTC)

Also, there is some ambiguity in the page about which Easter calculus should be used and which calendar to display dates on the screen. If the computus depends on the church and there are only two of them, then the date on the screen, in my opinion, should be done using the civil (secular) calendar.

For example, Russian Easter is accurately calculated by the year number with just two expressions: d = (y % 19 * 19 + 15) % 30; d + = (y % 4 * 2 + y % 7 * 4 + 6 * d + 6) % 7. This rule was established by the Church Fathers and has not changed since 325 (for Russians, this is more important than for Catholics , because it is Easter that is the main holiday in Orthodox Christianity). Further, if the year is less than 1918 then we add the resulting number to March 22 and get the date according to the Julian calendar. Otherwise, we calculate the correction for the Gregorian calendar and display the date in the new style. Everything is simple and clear here.

For western churches, the situation is different: the Roman Church introduced a new algorithm in 1582, but countries adopted the new calendar gradually, until the mid-20th century. Therefore, it is difficult to determine in which calendar for which year to display the date. That is, the year 1582 has neither astronomical nor political significance, it is just the time of the proposal for a new calendar. I guess it should be parameterizable values. But most of the algorithms do not even take this into account, calculating the date of Easter in 400 according to the Catholics algorithm and displaying the date according to the Gregorian calendar, which, in my opinion, is absurd (remember that from the point of view of Christianity, all regulations and innovations of Catholics are heresy). Русский (talk) 10:21, 8 March 2021 (UTC)

Apologies for the misinformation about Christmas (I think that was me; I was in any case under that same mistaken belief). But let's not refer to anyone's faith as "heresy" here, please. This is a programming site, not a place to get into a literal religious debate. I have edited the desciption text to be hopefully both more accurate and more balanced. --Markjreed (talk) 15:48, 8 March 2021 (UTC)
Ok, it looks good. I would like to draw your attention to the problem again. The description correctly says: "In the year 400 CE, Easter Sunday was April 1st", this is the date according to the calendar valid in the 400th year. However, in most solutions, the date is April 2, that is, Monday. I suppose that the solution to this task should be the following (I wrote the code in JS, but I think everyone understands it):
<lang javascript>function getEasterDate(year = new Date().getFullYear(), church = 1, calendar = year < 1918 ? 1 : 2) {

/* year: a number of the year (from 325 CE); church: an algorithm of the computus, for Orthodox = 1; for Catholic = 2; calendar: a calendar of the output date, Julian = 1; Gregorian = 2. */

if (church == 1) { let d = (year % 19 * 19 + 15) % 30; d += (year % 4 * 2 + year % 7 * 4 + 6 * d + 6) % 7; if (calendar == 1) return d > 9 ? [d - 9, 4] : [22 + d, 3]; else if (calendar == 2) { const c = (year / 100 | 0) - (year / 400 | 0) - 2; return d > 39 - c ? [d - 39 + c, 5] : [d - 9 + c, 4]; } }

else if (church == 2) { const a = year % 19, b = year / 100 | 0, c = year % 100, d = (19 * a + b - (b / 4 | 0) - ((b - ((b + 8) / 25 | 0) + 1) / 3 | 0) + 15) % 30, e = (32 + 2 * (b % 4) + 2 * (c / 4 | 0) - d - c % 4) % 7, f = d + e - 7 * ((a + 11 * d + 22 * e) / 451 | 0) + 114; if (calendar == 1) { const g = f % 31 + 1, h = (year / 100 | 0) - (year / 400 | 0) - 2; return g <= h ? [31 + g - h, 3] : [g - h, f / 31 | 0]; } else if (calendar == 2) return [f % 31 + 1, f / 31 | 0]; } }

const OrthodoxHolidays = [["Easter", 1], ["Ascension", 40], ["Trinity (Pentecost)", 50], ["All Saints' Sunday", 57]], CatholicHolidays = [["Easter", 1], ["Ascension", 40], ["Pentecost", 50], ["Trinity Sunday", 57], ["Corpus Christi", 61]];

const firstYearOfNewStyle = 1918;

function getHolidaysDates(year, church) { const Easter = getEasterDate(year, church, year < firstYearOfNewStyle ? 1 : 2), holidays = church == 1 ? OrthodoxHolidays : CatholicHolidays; return year + ": " + holidays.map(h => { const d = new Date(year, Easter[1] - 1, Easter[0]); d.setDate(d.getDate() + h[1] - 1); return h[0] + ": " + new Intl.DateTimeFormat("ru", { month: "numeric", day: "numeric" }).format(d); }).join("; ") + "."; }

document.write(getHolidaysDates(400, 1));</lang>