penance316 / laravel-iso8601-validator
laravel iso8601 date validation package
Installs: 444 564
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 3
Forks: 1
Open Issues: 1
Requires
- php: >=5.4.0
- illuminate/support: >=5.0.0
Requires (Dev)
- phpunit/phpunit: >=4.0
This package is auto-updated.
Last update: 2024-10-29 04:53:25 UTC
README
Install
composer require "penance316/laravel-iso8601-validator"
Add the required validator to boot method of app/Providers/AppServiceProvider.php
Validator::extend('iso_date', 'Penance316\Validators\IsoDateValidator@validateIsoDate');
Add the following lines to resources/lang/en/validation.php
'iso_date' => 'The :attribute must be a valid ISO8601 string.',
Use like other validators
...
'reference' => 'required|max:255',
'startDate' => 'required|iso_date',
'email' => 'required|email',
...
Only UTC
- Valid
2012-04-23T18:25:43.511Z
2010-02-18T16:23.33+0600
- No valid
2012-04-23
2010-02-18T16:23.33
'startDate' => 'required|iso_date:utc',