azuyalabs / yasumi

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

Symfony 4 integration #144

Closed TELLO0815 closed 5 years ago

TELLO0815 commented 5 years ago

Hi all,

sorry im new bee. I want to use Yasumi to check in Symfony the date for Swiss if it is a holiday or not. How can I get datas for two years? Like im on the end of the year... Or must I write it with the year now and second array with the year + 1?

$holidays_1 = Yasumi\Yasumi::create('USA', 2019);
$holidays_2 = Yasumi\Yasumi::create('USA', 2020);

TELLO

stelgenhof commented 5 years ago

Hi,

At the moment there is only one way of doing it and that is like in your example: you would need to instantiate Yasumi twice. This is because the Yasumi class only can cover a single year.

As for checking if a date is a working day or not, you can use the isWorkingDay function (see the AbstractProvider class for more details).

Cheers! Sacha

stelgenhof commented 5 years ago

@TELLO0815 Just want to get back to you. Did my reply answer your question? If so, I will close this issue.