span {
color: green;
}
.bd {
border: 3px solid blue;
border-radius: 10px;
padding: 10px;
background: #ade9ff;
}
.br {
border: 3px solid red;
border-radius: 10px;
padding: 10px;
background: #facec8;
}
body {
background: lightgray;
}
#rez {
color: red;
font-size: 32px;
font-weight: bold;
}
Easter date calculation
Instructions
Step one:
- A is quotient obtained by division of the selected year by 100
- B is residual/remainder when dividing selected year by 100
Step two
- a = (A + 8) / 25 (discard residual/remainder)
Step three
- b = (A + 1 – a) / 3 (discard residual/remainder)
Step four
- c = A / 4 (discard residual/remainder)
Step five
- d is residual/remainder when dividing selected year by 19
Step six
- f is residual/remainder when dividing (11d + 1) by 30
Step seven
- g is residual/remainder when dividing (A – b – c – f + 46) by 30
Step eight
- h = B / 4 (discard residual/remainder)
Step nine
- k is residual/remainder when dividing (5A + B + h + c) by 7
Step ten
- m is residual/remainder when dividing (39 – g – k) by 7
Step eleven
- If g + m > 9 Easter is on (g + m – 9)[st/nd/rd/th] of April
- If g + m ≤ Easter is on (22 + g – m)[st/nd/rd/th] of March
Exceptions:
- If g = 29 and m = 6 Easter is on 19th, not 26th, of April
- If g = 28 and m = 6 Easter is on 18th, not 25th, of April
You can check your result here
Remark:
– next step will be displayed if the result in the current step is correct.
Calculate and enter the result in input fields:
- A: quotient in division selected year and 100 (year / 100)
- B: residual/remainder in division year and 100
- a: (A + 8) / 25 (discard residual/remainder)
- b: (A + 1 – a) / 3 (discard residual/remainder)
- d: residual/remainder when dividing selected year by 19
- f: residual/remainder when dividing (11d + 1) / 30
- g: residual/remainder when dividing (A – b – c – f + 46) / 30
- h: quotient when dividing B / 4
- k: residual when dividing (5A + B + h + c) / 7
- m: residual/remainder when dividing (39 – g – k) / 7
var zadanaGodina, A, B, a2, b2, c, d, f, g, h, k, m;
A = 0;
B = 0;
a2 = 0;
b2 = 0;
c = 0;
d = 0;
f = 0;
g = 0;
h = 0;
k = 0;
m = 0;
var result = “”;
var eDay = 0;
var eMonth = “”;
function ordNum(d) {
if((d % 10) == 1 && (d 20)) {
return (d + “st”);
}
if((d % 10) == 2 && (d 20)) {
return (d + “nd”);
}
if((d % 10) == 3 && (d 20)) {
return (d + “rd”);
}
return (d + “th”)
}
function calcResult() {
if((g + m) > 9) {
eDay = (g + m – 9);
eMonth = “April”;
}
if((g + m) <= 9) {
eDay = (22 + g – m);
eMonth = "March";
}
if(g == 29 && m == 6) {
eDay = 19;
eMonth = "March";
}
if(g == 28 && m == 6) {
eDay == 18;
eMonth = "March";
}
result = "The " + ordNum(eDay) + " of " + eMonth + " " + $("#godina").val();
}
$(document).ready(function () {
var datum = new Date();
var godina = datum.getFullYear();
$("#godina").val(godina);
$("#AOK").hide();
$("#BOK").hide();
$("#korak2").hide();
$("#a2ok").hide();
$("#korak3").hide();
$("#b2ok").hide();
$("#korak4").hide();
$("#cok").hide();
$("#korak5").hide();
$("#dok").hide();
$("#korak6").hide();
$("#fok").hide();
$("#korak7").hide();
$("#gok").hide();
$("#korak8").hide();
$("#hok").hide();
$("#korak9").hide();
$("#kok").hide();
$("#korak10").hide();
$("#mok").hide();
$("#result").hide();
$("#r2").hide();
$(document).on("click", "#show", function () {
calcResult();
$("#result").html(
"
” + result + “”
);
$(“#result”).append(
“
For new calculation press ‘F5’.
”
);
});
$(document).on(“change keyup focusout”, “#godina”, function() {
zadanaGodina = parseInt($(“#godina”).val());
A = parseInt(zadanaGodina / 100);
B = parseInt(zadanaGodina % 100);
});
$(document).on(“change keyup focusout”, “#A, #B”, function() {
var rA = parseInt($(“#A”).val());
var rB = parseInt($(“#B”).val());
if(rA == A) {
$(“#AOK”).show();
}
else {
$(“#AOK”).hide();
}
if(rB == B) {
$(“#BOK”).show();
}
else {
$(“#BOK”).hide();
}
if((rA == A) && (rB == B)) {
$(“#korak2”).show();
a2 = parseInt((A + 8) / 25);
$(“#a2”).trigger(“change”);
}
else {
$(“#korak2”).hide();
$(“#korak3”).hide();
$(“#korak4”).hide();
$(“#korak5”).hide();
$(“#korak6”).hide();
$(“#korak7”).hide();
$(“#korak8”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#a2”, function() {
var ra2 = parseInt($(“#a2”).val());
if(ra2 == a2) {
$(“#a2ok”).show();
$(“#korak3”).show();
b2 = parseInt((A + 1 – a2) / 3);
$(“#b2”).trigger(“change”);
}
else {
$(“#a2ok”).hide();
$(“#korak3”).hide();
$(“#korak4”).hide();
$(“#korak5”).hide();
$(“#korak6”).hide();
$(“#korak7”).hide();
$(“#korak8”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#b2”, function() {
var rb2 = parseInt($(“#b2”).val());
if(rb2 == b2) {
$(“#b2ok”).show();
$(“#korak4”).show();
c = parseInt(A / 4);
$(“#c”).trigger(“change”);
}
else {
$(“#b2ok”).hide();
$(“#korak4”).hide();
$(“#korak5”).hide();
$(“#korak6”).hide();
$(“#korak7”).hide();
$(“#korak8”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#c”, function() {
var rc = parseInt($(“#c”).val());
if(c == rc) {
$(“#korak5”).show();
$(“#cok”).show();
d = parseInt(parseInt($(“#godina”).val()) % 19);
$(“#d”).trigger(“change”);
}
else {
$(“#cok”).hide();
$(“#korak5”).hide();
$(“#korak6”).hide();
$(“#korak7”).hide();
$(“#korak8”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#d”, function() {
var rd = parseInt($(“#d”).val());
if(d == rd) {
$(“#korak6”).show();
$(“#dok”).show();
f = parseInt((11 * d + 1) % 30);
$(“#f”).trigger(“change”);
}
else {
$(“#dok”).hide();
$(“#korak6”).hide();
$(“#korak7”).hide();
$(“#korak8”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#f”, function() {
var rf = parseInt($(“#f”).val());
if(f == rf) {
$(“#korak7”).show();
$(“#fok”).show();
g = (A – b2 – c – f + 46) % 30;
$(“#g”).trigger(“change”);
}
else {
$(“#fok”).hide();
$(“#korak7”).hide();
$(“#korak8”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#g”, function() {
var rg = parseInt($(“#g”).val());
if(rg == g) {
$(“#korak8”).show();
$(“#gok”).show();
h = parseInt(B / 4);
$(“#h”).trigger(“change”);
}
else {
$(“#gok”).hide();
$(“#korak8”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#h”, function () {
var rh = parseInt($(“#h”).val());
if(rh == h) {
$(“#korak9”).show();
$(“#hok”).show();
k = parseInt((5 * A + B + h + c) % 7);
$(“#k”).trigger(“change”);
}
else {
$(“#hok”).hide();
$(“#korak9”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#k”, function () {
var rk = parseInt($(“#k”).val());
if(rk == k) {
$(“#korak10”).show();
$(“#kok”).show();
m = parseInt((39 – g – k) % 7);
}
else {
$(“#kok”).hide();
$(“#korak10”).hide();
$(“#result”).hide();
}
});
$(document).on(“change keyup focusout”, “#m”, function () {
var rm = parseInt($(“#m”).val());
if(rm == m) {
$(“#mok”).show();
$(“#result”).show();
}
else {
$(“#mok”).hide();
$(“#result”).hide();
}
});
$(“#godina”).trigger(“change”);
});