Module:Easter and Module:Easter/sandbox: Difference between pages
Appearance
(Difference between pages)
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, |
["Julian"] = 1, |
||
["Eastern"] = 2, |
["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"] = 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 |
|||
}, |
}, |
||
⚫ | |||
-- |
-- and any proposed reformed algorithms are not supported (yet): |
||
-- |
|||
⚫ | |||
⚫ | |||
-- |
-- * fifteenth Sunday of the year: Sunday in 099–105 day of the year |
||
⚫ | |||
⚫ | |||
⚫ | |||
-- differs from Gregorian sometimes |
|||
-- * |
-- * Sunday after 6 April (Pepuzite sect): Sunday in 7–13 April |
||
-- |
-- * World Calendar: day 099, any day of the week in Gregorian/Julian calendar |
||
-- |
-- * Positivist Calendar: day 098, any day of the week in Gregorian/Julian calendar |
||
⚫ | |||
-- |
-- * 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): |
|||
-- |
-- * Sunday of ISO week 15: Sunday in 106–112 day of the year |
||
-- |
-- * Nisan 14: any day of the week |
||
⚫ | |||
-- * |
-- * 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, |
||
[" |
["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 |
["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 |
||
⚫ | |||
-- Gregorian: |
|||
-- 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 |
if d > 61 then |
||
-- when the original calculation is converted to the Gregorian |
|||
-- Easter Sunday can occur in May |
-- calendar, Easter Sunday can occur in May |
||
return 5, d - 61 |
|||
return 6, d - 92 -- June |
|||
⚫ | |||
return 5, d - 61 -- May |
|||
elseif d > 31 then |
elseif d > 31 then |
||
return 4, d - 31 |
return 4, d - 31 |
||
else |
else |
||
return 3, d |
return 3, d |
||
end |
end |
||
end |
end |