From 9d9d4d2dcdd18c0d241ce6cda85b380416cd7acd Mon Sep 17 00:00:00 2001 From: Warren White Date: Thu, 7 Mar 2024 08:53:32 -0800 Subject: [PATCH 1/2] Fixed: incorrect date for Victoria Day in 2024 is May 20th, not May 27th --- .../CanadaTest/it_can_calculate_canadian_holidays.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap index 3168b8ea2..19caffc6d 100644 --- a/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap +++ b/tests/.pest/snapshots/Countries/CanadaTest/it_can_calculate_canadian_holidays.snap @@ -13,7 +13,7 @@ }, { "name": "Victoria Day", - "date": "2024-05-27" + "date": "2024-05-20" }, { "name": "Canada Day", From 619930adba23de3e11cb2413b2a4a149919aca1f Mon Sep 17 00:00:00 2001 From: Warren White Date: Thu, 7 Mar 2024 09:00:20 -0800 Subject: [PATCH 2/2] Fixed: Victoria day is the first Monday preceding May 25th Changed from the last Monday of May which is incorrect. --- src/Countries/Canada.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Countries/Canada.php b/src/Countries/Canada.php index f1350e198..414a8369d 100644 --- a/src/Countries/Canada.php +++ b/src/Countries/Canada.php @@ -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,