Skip to content

Commit

Permalink
Fixes : (#326)
Browse files Browse the repository at this point in the history
- Easter day calculation rounding for the lunar correction when not using calendar extension
- Added some phpunit test that checks cases that were incorrect before
  • Loading branch information
rChassat authored Dec 3, 2023
1 parent 8d67a7a commit 404b641
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/ChristianHolidays.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ protected function calculateEaster(int $year, string $timezone): \DateTimeInterf
}

$solar = (int) (($year - 1600) / 100) - (int) (($year - 1600) / 400); // The solar correction
$lunar = (int) (($year - 1400) / 100 * 8 / 25); // The lunar correction
$lunar = (int) (((int) (($year - 1400) / 100) * 8) / 25); // The lunar correction

$pfm = (3 - (11 * $golden) + $solar - $lunar) % 30; // Uncorrected date of the Paschal full moon
}
Expand Down
7 changes: 7 additions & 0 deletions tests/Belgium/EasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public function testEaster(): void
$year,
new \DateTime("{$year}-4-4", new \DateTimeZone(self::TIMEZONE))
);
$year = 2025;
$this->assertHoliday(
self::REGION,
self::HOLIDAY,
$year,
new \DateTime("{$year}-4-20", new \DateTimeZone(self::TIMEZONE))
);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions tests/France/EasterMondayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public function testEasterMonday(): void
$year,
new \DateTime("{$year}-3-28", new \DateTimeZone(self::TIMEZONE))
);
$year = 2025;
$this->assertHoliday(
self::REGION,
self::HOLIDAY,
$year,
new \DateTime("{$year}-4-21", new \DateTimeZone(self::TIMEZONE))
);
}

/**
Expand Down

0 comments on commit 404b641

Please sign in to comment.