Calculate number of working days in a date range
- PHP >= 7.4
- Composer
composer install
composer tests
The command below will run PHPStan level 4 analysis.
composer code-analysis
$days = (new WorkingDays('2019-06-06', '2019-06-11'))->calculate();
$days->getNumber(); //output: 04
$days->getDayList(); //output: ['2019-06-06', '2019-06-07', '2019-06-10', '2019-06-11']
$holidays = ['2019-06-06'];
$days = (new WorkingDays('2019-06-05', '2019-06-11', $holidays))->calculate();
$days->getNumber(); //output: 04
$days->getDayList(); //output: ['2019-06-05', '2019-06-07', '2019-06-10', '2019-06-11']