shakahl/due-php

Due date calculator written in PHP

v1.0.2 2018-05-12 20:10 UTC

This package is not auto-updated.

Last update: 2024-12-08 07:08:50 UTC


README

This project is a due date calculator library written in PHP.

Structure

bin/   - executable files for Composer
src/   - library source
tests/ - Executable files for Composer

Features

The program reads the currently reported problems (bugs) from an issue tracking system and calculates the due date following the rules below:

  • Working hours can be specified. Defaults are 9AM to 5PM every working day (Monday through Friday)
  • The program does not deal with holidays, which means that a holiday on a Thursday is still considered as a working day by the program. Also a working Saturday will still be considered as a nonworking day by the system.
  • The turnaround time is given in working hours, which means for example that 2 days are 16 hours. As an example: if a problem was reported at 2:12PM on Tuesday then it is due by 2:12PM on Thursday.
  • All submitted date values must be between working hours.

Usage

As a library

composer require shakahl/due-php
use Shakahl\Due\DueDateCalculator;

$calculator = DueDateCalculator::make();

$calculator->setDayStart(9);
$calculator->setDayEnd(17);

$dueDate = $calculator->calculate('2018-05-11 11:23:42', 7);

echo $dueDate->format('c'); // 2018-05-14T10:23:42+00:00

CLI - Command line interface

composer global require shakahl/due-php
due calculate "2018-05-11 11:23:42" 7

Testing

$ composer test

Credits

License

The MIT License (MIT). Please see License File for more information.