Skip to content

Commit

Permalink
Merge pull request #211 from mercury64/main
Browse files Browse the repository at this point in the history
Fix: Canada Victoria Day correction in test and calculation
  • Loading branch information
Nielsvanpach authored Mar 8, 2024
2 parents 7010c1f + 619930a commit 210d4a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/Countries/Canada.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ protected function variableHolidays(int $year): array
{
$easter = $this->easter($year);

$victoriaDay = (new CarbonImmutable("last monday of May $year"))->startOfDay();

if ($victoriaDay->day < 25) {
$victoriaDay = $victoriaDay->addWeek();
}
// the Monday preceding May 25
$victoriaDay = CarbonImmutable::createFromFormat( 'Y-m-d', "{$year}-05-25" )
->previous('Monday');

return [
'Victoria Day' => $victoriaDay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
{
"name": "Victoria Day",
"date": "2024-05-27"
"date": "2024-05-20"
},
{
"name": "Canada Day",
Expand Down

0 comments on commit 210d4a5

Please sign in to comment.