Skip to content

Diego-Brocanelli/calculate-working-days

Repository files navigation

Calculate Working Days

Calculate number of working days in a date range

Maintainability

Requirements

  • PHP >= 7.4
  • Composer

Instalation

composer install

Tests

composer tests

Code Analysis

The command below will run PHPStan level 4 analysis.

composer code-analysis

Examples

A simple interval

$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']

with holidays list

$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']

Author

Diego Brocanelli Francisco

License

MIT