diego-brocanelli/calculate-working-days

Responsible for calculating working days between a date range

1.0.0 2019-06-11 19:39 UTC

This package is auto-updated.

Last update: 2024-04-08 06:55:41 UTC


README

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