Download the PHP package indieweb/date-formatter without Composer
On this page you can find all versions of the php package indieweb/date-formatter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download indieweb/date-formatter
More information about indieweb/date-formatter
Files in indieweb/date-formatter
Package date-formatter
Short Description Render dates and date ranges in a human-readable format, including proper microformats-2 markup
License Apache-2.0
Homepage https://github.com/indieweb/date-formatter-php
Informations about the package date-formatter
Date Formatter
Render dates and date ranges in a human-readable format, including proper microformats-2 markup.
Usage
Date Range with Time
outputs
(whitespace added for readability)
which displays in a browser as
Date Range with No Time
outputs
which displays in a browser as
Other Examples
This example shows how progressively more data is added to the output as the start and end dates have less in common with each other.
Here are similar examples when the dates include times as well.
Alternate Class Names
If you want the HTML to include Microformats classes other than "dt-start" and "dt-end", you can pass class names as additional parameters.
Tests
Please see the tests for more complete examples of different output formats.
Future Enhancements
- Optionally also display the day of the week in date range output
- Option to use short month names instead of full names
- Make the parser more tolerant of other input formats
If you see other input or output formats you would like handled, please open an Issue with a description. Bonus points if you write it as a test case:
License
Copyright 2015 by Aaron Parecki
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.