2018-01-29 09:37:40 +01:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2019-02-09 11:44:33 +01:00
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2018-01-29 09:37:40 +01:00
|
|
|
require 'vendor/autoload.php';
|
|
|
|
|
|
|
|
use Respect\Validation\Validator as v;
|
|
|
|
|
2020-06-23 21:26:23 +02:00
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
|
2023-04-01 07:20:05 +02:00
|
|
|
exceptionMessage(static fn() => v::date()->check('2018-01-29T08:32:54+00:00'));
|
|
|
|
exceptionMessage(static fn() => v::not(v::date())->check('2018-01-29'));
|
|
|
|
exceptionFullMessage(static fn() => v::date()->assert('2018-01-29T08:32:54+00:00'));
|
|
|
|
exceptionFullMessage(static fn() => v::not(v::date('d/m/Y'))->assert('29/01/2018'));
|
2018-01-29 09:37:40 +01:00
|
|
|
?>
|
2018-12-19 18:05:58 +01:00
|
|
|
--EXPECT--
|
2018-01-29 09:37:40 +01:00
|
|
|
"2018-01-29T08:32:54+00:00" must be a valid date in the format "2005-12-30"
|
|
|
|
"2018-01-29" must not be a valid date in the format "2005-12-30"
|
|
|
|
- "2018-01-29T08:32:54+00:00" must be a valid date in the format "2005-12-30"
|
|
|
|
- "29/01/2018" must not be a valid date in the format "30/12/2005"
|