clippings / date-utils
Utility for date spans
0.4.0
2020-02-18 08:28 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-11-18 18:43:55 UTC
README
Utility for days and date spans
Installation
Install via composer
composer require clippings/date-utils
Usage
$span = new DaysSpan(new Days(20), new Days(40)); $start = new DateTime('today'); $dates = $span->toDateTimeSpan($start); echo $dates->humanize(); // For week days $span = new WeekDaysSpan(new WeekDays(20), new WeekDays(40)); $start = new DateTime('today'); $dates = $span->toDateTimeSpan($start); // For business with support of lists of holidays $holidays = new Holidays([ new DateTime('<Holiday 1>'), new DateTime('<Holiday 2>'), ]); $span = new BusinessDaysSpan(new BusinessDays(20, $holidays), new BusinessDays(40, $holidays)); $start = new DateTime('today'); $dates = $span->toDateTimeSpan($start);
License
Copyright (c) 2015, Clippings Ltd. Developed by Ivan Kerin
Under BSD-3-Clause license, read LICENSE file.