Talk:Holidays related to Easter: Difference between revisions

m
 
(9 intermediate revisions by 3 users not shown)
Line 1:
==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.) --[[User:Rdm|Rdm]] 14:40, 29 June 2010 (UTC)
 
Line 33 ⟶ 34:
 
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. --[[User:Spoon!|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. --[[User:Markjreed|Markjreed]] ([[User talk: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. [[User:Русский|Русский]] ([[User talk:Русский|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). [[User:Русский|Русский]] ([[User talk:Русский|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. --[[User:Markjreed|Markjreed]] ([[User talk: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>