Diego-Brocanelli / calculate-working-days

Calculate number of working days in a date range

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Calculate number of working days in a date range

License:MIT License


Languages

Language:PHP 91.4%Language:Dockerfile 8.6%