Download the PHP package gamajo/daterange without Composer
On this page you can find all versions of the php package gamajo/daterange. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gamajo/daterange
More information about gamajo/daterange
Files in gamajo/daterange
Package daterange
Short Description Display a range of dates, with consolidated time parts.
License MIT
Homepage https://github.com/GaryJones/date-range
Informations about the package daterange
Gamajo Date Range
Display a range of dates, with consolidated time parts.
Table Of Contents
- Installation
- Basic Usage
- Advanced Usage
- Contributing
- License
Installation
The best way to use this package is through Composer:
Basic Usage
Create an instance of the DateRange
class, with DateTimeImmutable
or DateTime
start and end date-time objects as arguments. Then choose the format to use as the end date output. The start date will only display the time parts that are not duplicated.
If the formatted date would be the same start and end date, only a single date is displayed:
Advanced Usage
Change Separator
The default separator between the start and end date, is a space, en-dash, space: ' – '
This can be changed via the changeSeparator()
method:
Change Removable Delimiters
The consolidation and removal of some time parts may leave delimiters from the format:
Be default, /
, -
and .
are trimmed from the start date, but this can be amended with the changeRemovableDelimiters()
method:
Known Issues
These are known issues which need addressing before this package can be considered stable:
- Escaped characters are not handled correctly
- Duplicate time parts are not handled correctly
- Hours, minutes and seconds are not handled correctly
Contributing
All feedback, bug reports and pull requests are welcome.
License
Copyright (c) 2018 Gary Jones, Gamajo
This code is licensed under the MIT License.