Skip to content

Commit

Permalink
Merge pull request laravel#16692 from rohitsubedi/rohitsubedi-patch-1
Browse files Browse the repository at this point in the history
[5.3] Fix date_format validation for all formats
  • Loading branch information
taylorotwell authored Dec 7, 2016
2 parents e91f04b + 914ef36 commit 4c70ab0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Validation/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1835,9 +1835,9 @@ protected function validateDateFormat($attribute, $value, $parameters)
return false;
}

$parsed = date_parse_from_format($parameters[0], $value);
$date = DateTime::createFromFormat($parameters[0], $value);

return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
return $date && $date->format($parameters[0]) === $value;
}

/**
Expand Down

0 comments on commit 4c70ab0

Please sign in to comment.