File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -403,8 +403,11 @@ public static function datetime(
403403 if ($ data === null ) {
404404 return false ;
405405 }
406- $ data = \DateTime::createFromFormat ($ format , $ data );
407- if ($ data === false ) {
406+ $ datetime = \DateTime::createFromFormat ($ format , $ data );
407+ if ($ datetime === false ) {
408+ return false ;
409+ }
410+ if ($ datetime ->format ($ format ) !== $ data ) {
408411 return false ;
409412 }
410413 $ lastErrors = \DateTime::getLastErrors ();
Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ public function testDatetime() : void
179179 self ::assertFalse (Validator::datetime ('foo ' , [
180180 'foo ' => '2022-02-29 25:10:10 ' ,
181181 ]));
182+ self ::assertFalse (Validator::datetime ('foo ' , [
183+ 'foo ' => '023-01-10 ' ,
184+ ], 'Y-m-d ' ));
182185 }
183186
184187 public function testEquals () : void
You can’t perform that action at this time.
0 commit comments