Easter Date Calculation. Adapted from BASIC code found on
Ronald W. Mallen's Easter Dating Method web page and written by Greg Mallen.
To view the HTML and JavaScript source, see the View menu.
Tested successfully against:
- Netscape version 4.07 for Linux and 4.5 for Windows 95 and Macintosh
- Internet Explorer version 4.0 for Windows 95 and 4.01 for Macintosh
Here's the original code for comparison with the main JavaScript
function easterDateCalc():
Sub EasterDate (d, m, y)
' EASTER DATE CALCULATION FOR YEARS 1583 TO 4099
' y is a 4 digit year 1583 to 4099
' d returns the day of the month of Easter
' m returns the month of Easter
' Easter Sunday is the Sunday following the Paschal Full Moon (PFM) date
' for the year
' This algorithm derives values by iterative and inter-dependent processes,
' so ... DO NOT MODIFY THE ORDER OF CALCULATIONS!
' Boolean expressions are used in calculations: -1 if true, 0 if false
' \ means integer division (so, 1995 \ 100 = 19)
Dim a, b, c ' intermediate results, all integers
Dim tA, tB, tC, tD, tE ' table A - E results, all integers
' y must be 1583 to 4099
a = y \ 100
b = y Mod 19
' calculate PFM date
c = (a - 15) \ 2 + (a > 26) + (a > 38) + 202 - 11 * b
c = c + ((a = 21) Or (a = 24) Or (a = 25) Or (a = 33) Or (a = 36) Or (a = 37))
c = c Mod 30
tA = c + (c = 29) + (c = 28 And b > 10) + 21 ' table A result (21=M21 to 49=A18)
' find the next Sunday
tB = (tA - 19) Mod 7 ' table B result
c = (40 - a) Mod 4
tC = c - (c > 1) - (c = 3) ' table C result
c = y Mod 100
tD = (c + c \ 4) Mod 7 ' table D result
tE = ((20 - tB - tC - tD) Mod 7) + 1 ' table E result
' return the date
d = tA + tE
If d > 31 Then
d = d - 31
m = 4
Else
m = 3
End If
End Sub