azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.04k stars 152 forks source link

prevWorkingDay/nextWorkingDay to take into account only official holidays #232

Closed tadasauciunas closed 3 years ago

tadasauciunas commented 3 years ago

Hi, I have a feature request for prevWorkingDay / nextWorkingDay methods. I want the ability to ask the isWorkingDay method to return true only on official holidays. Currently it returns true on observance and other types of holidays, and that makes the prevWorkingDay / nextWorkingDay functions not work correctly in our case, since observance holidays might be working days officially. I'd be happy to put in a pull request with an optional query parameter to the mentioned methods that does not change the current behavior unless you set it explicitly, to keep compatibility. Let me know if you think this sort of functionality would be useful.

tadasauciunas commented 3 years ago

My bad, apparently not all 'observance' holidays should be removed from the list we need, so extending the holiday providers and removing the unnecessary holidays will be enough in our case.

stelgenhof commented 3 years ago

Hi @tadasauciunas Extending the providers is definitely a solution. However I am aware that the way Yasumi determines a working day / non working day is not working correctly. Working on that one... :)