Jump to content

Module:Easter and Module:Easter/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
blank edit: everything is fine now
 
create synced
 
Line 1: Line 1:
local m = {}
local m = {}


local EasterData = {
local EasterData = {
Line 26: Line 26:
methods = {
methods = {
["Julian"] = 1, -- Eastern date in the Julian calendar
["Julian"] = 1,
["Eastern"] = 2, -- Eastern date in the Gregorian calendar
["Eastern"] = 2,
["Orthodox"] = 2, -- alias for Eastern
["Orthodox"] = 2, -- alias for Eastern
["Coptic"] = 2, -- alias for Eastern
["Coptic"] = 2, -- alias for Eastern
["Ethiopian"] = 2, -- alias for Eastern
["Ethiopian"] = 2, -- alias for Eastern
["Western"] = 3, -- Western date in the Gregorian calendar
["Western"] = 3,
["Gregorian"] = 3, -- alias for Western
["Gregorian"] = 3, -- alias for Western
["Catholic"] = 3, -- alias for Western
["Roman"] = 3, -- alias for Western
["Roman"] = 3, -- alias for Western
["Revised"] = 4, -- defacto alias for Western for now
["Meletian"] = 4, -- alias for Revised
["Astro"] = 5, -- defacto alias for Western for now
},
},
-- the Meletian/Revised Julian Calendar from 1923 used by some Orthodox churches
-- other proposed or reformed algorithms are not supported (yet):
-- and any proposed reformed algorithms are not supported (yet):
--
-- * astronomically observed Nicean rule at the meridian of Jerusalem (Aleppo 1997 proposal), differs from Gregorian in
-- * 4 "Meletian" = "Revised": Revised Julian Calendar from 1923 used by some Orthodox churches
-- with 900-year leap cycle, same as Gregorian until 2400 or so
-- * fifteenth Sunday of the year: Sunday in 099–105 day of the year
-- * Sunday after second Saturday in April (UK): Sunday in 9–15 April
-- * 5 "Astro": astronomically observed Nicean rule at the meridian of Jerusalem (Aleppo 1997 proposal),
-- * second Sunday in April: Sunday in 8–14 April
-- differs from Gregorian sometimes
-- * 6 based on (equivalently) a range of valid dates in April:
-- * Sunday after 6 April (Pepuzite sect): Sunday in 7–13 April
-- * 61 "First": 1st Sunday in April = Sunday in 1–7 April
-- * World Calendar: day 099, any day of the week in Gregorian/Julian calendar
-- * 67 "Pepuzite": Sunday after 6 April = Sunday in 7–13 April
-- * Positivist Calendar: day 098, any day of the week in Gregorian/Julian calendar

-- * 68 "April" = "Second": 2nd Sunday in April = Sunday in 8–14 April
-- * 69 "Fixed" = "UK": day after second Saturday in April = Sunday in 9–15 April
-- * Sunday of ISO week 14: Sunday in 099–105 day of the year

-- * 7 based on (equivalently) a range of valid days of the year (DOY):
-- * 75 "W14": Sunday of ISO week 14 = Sunday in 095–101
-- * Sunday of ISO week 15: Sunday in 106–112 day of the year
-- * 79 "Fifteen": 15th Sunday of the year: Sunday in 099–105
-- * Nisan 14: any day of the week

-- * 72 "W15": Sunday of ISO week 15 = Sunday in 102–108
-- * "Symmetry": Sym454/Sym010: Sunday of week 14 in a 293-year leap cycle
-- * Nisan 15: any day of the week
--
-- Breaking from the Biblical week cycle, any day of the week in the Gregorian calendar:
--
-- * "World": day 099, Sunday in the World Calendar
-- * "Positivist": day 098, Sunday in the Positivst Calendar
-- * "Quartodecimanism": Nisan 14 in the contemporary Jewish/Hebrew calendar, pre-Nicean
-- * "Quintodecimanism": Nisan 15 in the contemporary Jewish/Hebrew calendar, pre-Nicean


Line 72: Line 61:
["Shrove Tuesday"] = -47, -- Mardi Gras, Carnival
["Shrove Tuesday"] = -47, -- Mardi Gras, Carnival
["Ash Wednesday"] = -46,
["Ash Wednesday"] = -46,
["Invocabit Sunday"] = -42,
["Laetare Sunday"] = -21,
["Reminiscere Sunday"] = -35,
["Oculi Sunday"] = -28,
["Laetare Sunday"] = -21, -- Mothering Sunday
["Holy Week"] = -7,
["Palm Sunday"] = -7,
["Palm Sunday"] = -7,
["Holy Monday"] = -6,
["Holy Tuesday"] = -5,
["Holy Wednesday"] = -4,
["Holy Wednesday"] = -4,
["Maundy Thursday"] = -3,
["Maundy Thursday"] = -3,
Line 86: Line 69:
["Easter"] = 0, -- Easter Sunday, Resurrection
["Easter"] = 0, -- Easter Sunday, Resurrection
["Easter Monday"] = 1,
["Easter Monday"] = 1,
["Divine Mercy Sunday"] = 7,
["Divine Mercy"] = 7,
["Misericordias Domini"] = 14,
["Jubilate Sunday"] = 21,
["Cantate Sunday"] = 28,
["Vocem jucunditatis"] = 35,
["Ascension Thursday"] = 39, -- Ascension
["Ascension Thursday"] = 39, -- Ascension
["Pentecost"] = 49, -- Whitsun
["Pentecost"] = 49, -- Whitsun
["Whit Monday"] = 50,
["Trinity Sunday"] = 56,
["Trinity Sunday"] = 56,
["Corpus Christi"] = 60, -- Body and Blood of Christ
["Corpus Christi"] = 60, -- Body and Blood of Christ
Line 185: Line 163:
3 = the revised calculation based on the
3 = the revised calculation based on the
Gregorian calendar
Gregorian calendar
4 = the revised calculation based on the
Meletian calendar
OUTPUTS: None.
OUTPUTS: None.
Line 224: Line 200:
-- Western or Orthodox Easter is valid since 1583
-- Western or Orthodox Easter is valid since 1583
return 0, formatEasterError(EasterData.errorIncorrectMethod, year)
return 0, formatEasterError(EasterData.errorIncorrectMethod, year)
end
if (year < 1600 or year > 2400) and method ~= 4 then
-- The Revised Julian Calendar is not really supported yet
return 0, formatEasterError(EasterData.errorYearOutOfRange, year)
end
end
Line 243: Line 215:
local d = 0
local d = 0
-- Julian:
if method == 1 or method == 2 then
if method == 1 or method == 2 then
-- calculate PFM date
-- calculate PFM date
Line 254: Line 225:
tE = ((20 - tB - tC - tD) % 7) + 1
tE = ((20 - tB - tC - tD) % 7) + 1
d = tA + tE
d = tA + tE
-- Eastern/Orthodox:
if method == 2 then
if method == 2 then
-- convert Julian to Gregorian date
-- convert Julian to Gregorian date
Line 266: Line 236:
d = d + temp
d = d + temp
end
end
elseif method == 3 then
-- Gregorian:
elseif method == 3 or method == 4 then
-- calculate PFM date
-- calculate paschal full moon (PFM) date
temp = math.floor((firstDig - 15) / 2) + 202 - 11 * remain19
temp = math.floor((firstDig - 15) / 2) + 202 - 11 * remain19
if firstDig > 26 then
if firstDig > 26 then
Line 304: Line 273:
return 0, formatEasterError(EasterData.errorUnknownMethod, method)
return 0, formatEasterError(EasterData.errorUnknownMethod, method)
end
end
-- when the original calculation is converted to the Gregorian calendar,
if d > 61 then
-- when the original calculation is converted to the Gregorian
-- Easter Sunday can occur in May or even in June in the distant future
-- calendar, Easter Sunday can occur in May
if d > 92 then
return 5, d - 61
return 6, d - 92 -- June
elseif d > 61 then
return 5, d - 61 -- May
elseif d > 31 then
elseif d > 31 then
return 4, d - 31 -- April
return 4, d - 31
else
else
return 3, d -- March
return 3, d
end
end
end
end