mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-25 11:02:17 +02:00
refactor: deobfuscate getEaster
function
This commit is contained in:
parent
150f14bedf
commit
be63dad3a1
@ -14,25 +14,25 @@ type MonthName =
|
||||
| 'november'
|
||||
| 'december';
|
||||
|
||||
// prettier-ignore
|
||||
const getEaster = (): Moment => {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const yearMod19 = currentYear % 19;
|
||||
const century = Math.floor(currentYear / 100);
|
||||
const yearInCentury = currentYear % 100;
|
||||
const centuryQuotient = Math.floor(century / 4);
|
||||
const centuryRemainder = century % 4;
|
||||
const specialCenturyTerm = Math.floor((century + 8) / 25);
|
||||
const specialCenturyCorrection = Math.floor((century - specialCenturyTerm + 1) / 3);
|
||||
const lunarCorrection = (19 * yearMod19 + century - centuryQuotient - specialCenturyCorrection + 15) % 30;
|
||||
const yearQuotient = Math.floor(yearInCentury / 4);
|
||||
const yearRemainder = yearInCentury % 4;
|
||||
const dayOfWeekCorrection = (32 + 2 * centuryRemainder + 2 * yearQuotient - lunarCorrection - yearRemainder) % 7;
|
||||
const specialLunarCorrection = Math.floor((yearMod19 + 11 * lunarCorrection + 22 * dayOfWeekCorrection) / 451);
|
||||
const easterMonth = Math.floor((lunarCorrection + dayOfWeekCorrection - 7 * specialLunarCorrection + 114) / 31);
|
||||
const easterDay = ((lunarCorrection + dayOfWeekCorrection - 7 * specialLunarCorrection + 114) % 31) + 1;
|
||||
|
||||
const a = currentYear % 19,
|
||||
b = Math.floor(currentYear / 100),
|
||||
c = currentYear % 100,
|
||||
d = Math.floor(b / 4),
|
||||
e = b % 4,
|
||||
f = Math.floor((b + 8) / 25),
|
||||
g = Math.floor((b - f + 1) / 3),
|
||||
h = (19 * a + b - d - g + 15) % 30,
|
||||
i = Math.floor(c / 4),
|
||||
k = c % 4,
|
||||
L = (32 + 2 * e + 2 * i - h - k) % 7,
|
||||
m = Math.floor((a + 11 * h + 22 * L) / 451),
|
||||
month = Math.floor((h + L - 7 * m + 114) / 31),
|
||||
day = ((h + L - 7 * m + 114) % 31) + 1;
|
||||
|
||||
return moment(new Date(currentYear, month - 1, day));
|
||||
return moment(new Date(currentYear, easterMonth - 1, easterDay));
|
||||
};
|
||||
|
||||
export const events = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user