tomasfejfar / datetime-strict
Simple DateTime wrapper allowing strict date and time validation
0.2
2016-12-06 14:11 UTC
Requires
- php: >=5.5
Requires (Dev)
- phpunit/phpunit: ~4.7|~5.0
- satooshi/php-coveralls: ^1.0
- squizlabs/php_codesniffer: ~2.3
This package is auto-updated.
Last update: 2024-11-06 10:10:58 UTC
README
Simple wrapper around DateTime to allow strict datetime validation
Install via Composer
composer require tomasfejfar/datetime-strict
Usage
use TomasFejfar\DateTime\DateTimeStrict; use TomasFejfar\DateTime\StrictFormatException; try { $date = DateTimeStrict::createFromFormat('Y-m-d H:i:s', '2001-33-05 13:35:08'); } catch (StrictFormatException $e) { $warnings = $e->getWarnings(); $errors = $e->getErrors(); }
Usage for immutable variant is the same, just use DateTimeImmutableStrict::createFromFormat()
instead.
Changelog
Changes can be found in each tag's annotation
Rules for contributing
- 1 PR per feature
- PR with tests are more likely to be merged
- tests and coding standard must pass
composer test
composer phpcs
Happy coding!