A very common requirement in our projects is the ability for the CRM to compute for the deadline of a Ticket. There are a lot of factors that have to be considered when computing deadlines such as weekends, operating hours that vary, etc
By default, the package assumes a 24/7 operation. The recommended usage is to pre-configure the class and bind it to the Service Provider of your application.
You can install the package via composer:
composer require bzarzuela/deadline-calculator
$calculator = new Bzarzuela\DeadlineCalculator();
$calculator->startFrom('2018-06-28 12:20:00);
$calculator->tatInDays(3);
echo $calculator->deadline(); // 2018-07-01 12:20:00
It supports bypassing weekends in the calculation.
$calculator->noWeekends();
TAT can also be set in hours
$calculator->tatInHours(24);
Operating Hours is supported for cases when TAT is measured in hours
$calculator->tatInHours(24)
->operatingHours('09:00:00', '17:00:00'); // 9am to 5pm working hours
You can also set or override operating hours on a per-day basis
$calculator->tatInHours(24)
->operatingHours('09:00:00', '17:00:00') // 9am to 5pm working hours
->saturday('09:00:00', '12:00:00') // Half day on Saturday
->noSunday(); // No work on Sundays
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.