Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dillchuk/timenormalize
A basic validator and filter for time input.
https://github.com/dillchuk/timenormalize
Last synced: about 2 months ago
JSON representation
A basic validator and filter for time input.
- Host: GitHub
- URL: https://github.com/dillchuk/timenormalize
- Owner: dillchuk
- License: mit
- Created: 2017-10-26T15:44:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-01T21:36:54.000Z (about 7 years ago)
- Last Synced: 2024-04-19T08:01:19.917Z (9 months ago)
- Language: PHP
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TimeNormalize
A basic validator and filter for time input.[![Build Status](https://travis-ci.org/dillchuk/TimeNormalize.svg?branch=master)](https://travis-ci.org/dillchuk/TimeNormalize)
## Installation
Install with `composer require illchuk/time-normalize`.
You may install in your ZendFramework app by adding to your `modules.config.php` the following:
~~~
return [..., 'TimeNormalize' ,...]; // validator and filter both called 'Time'
~~~Or use in a direct fashion:
~~~
use TimeNormalize\Validator\Time as TimeValidator;
use TimeNormalize\Filter\Time as TimeFilter;$validator = new TimeValidator;
echo $validator->isValid('12:34am'); // true
echo $validator->isValid('12:34jm'); // false$filter = new TimeFilter;
echo $filter->filter('12:34 am'); // '00:34'
echo $filter->filter('12:34 pm'); // '12:34'
echo $filter->filter('junk'); // 'junk'
~~~