Module:Easter and Module:Easter/sandbox: Difference between pages
(Difference between pages)
imported>MusikBot II m Protected "Module:Easter": High-risk template or module: 250 transclusions (more info) ([Edit=Require autoconfirmed or confirmed access] (indefinite)) |
imported>PC-XT 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 | ||
["Roman"] = 3, -- alias for Western | ["Roman"] = 3, -- alias for Western | ||
}, | }, | ||
-- | -- the Meletian/Revised Julian Calendar from 1923 used by some Orthodox churches | ||
-- 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 | |||
-- | -- * 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 | ||
-- * second Sunday in April: Sunday in 8–14 April | |||
-- * | -- * 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 | ||
-- * 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 | ||
-- * | |||
-- * | |||
-- * | |||
-- * | |||
| 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, | |||
["Laetare Sunday"] = -21 | |||
["Palm Sunday"] = -7, | ["Palm Sunday"] = -7, | ||
["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, | ||
["Ascension Thursday"] = 39, -- Ascension | ["Ascension Thursday"] = 39, -- Ascension | ||
["Pentecost"] = 49, -- Whitsun | ["Pentecost"] = 49, -- Whitsun | ||
["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 | ||
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 | end | ||
| Line 243: | Line 215: | ||
local d = 0 | local d = 0 | ||
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 | ||
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 | |||
elseif method == 3 | -- calculate PFM date | ||
-- calculate | |||
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 | |||
-- calendar, Easter Sunday can occur in May | |||
return 5, d - 61 | |||
return 5, d - 61 | |||
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 | ||