spatie / holidays

Calculate which days you don't have to work!
https://spatie.be/open-source
MIT License
328 stars 196 forks source link

[Bug]: Canada Victoria Day calculation and test is incorrect #210

Closed mercury64 closed 7 months ago

mercury64 commented 7 months ago

What happened?

Victoria Day in Canada for the year 2024 is May 20th. The tests snapshot has the date as May 27th which is incorrect for the year 2024.

The code for calculating Victoria Day is incorrect.

Victoria Day is always the preceding Monday from May 25th. It falls on the Monday between the 18th and the 24th.

How to reproduce the bug

The test case is incorrect. Adding the correct date in the test snapshot creates a failed test.

The code for calculating Victoria Day is incorrect, this is the bug.

Package Version

main

PHP Version

PHP 8.3.3 (cli) (built: Feb 13 2024 15:41:14) (NTS)

Which operating systems does with happen with?

macOS, Windows, Linux

Notes

I have updated the test snapshot with the correct date for Victoria Day. I have created a code fix for Canada Victoria Day calculation.

I will create a pull request.

mercury64 commented 7 months ago

Fix: Canada Victoria Day correction in test and calculation #211

Nielsvanpach commented 7 months ago

Thanks!