Skip to content

Commit

Permalink
Merge pull request #164 from JoshuaLuckers/develop
Browse files Browse the repository at this point in the history
Allow empty isDate, :required should be used to prevent blank field.
  • Loading branch information
joeke authored May 1, 2018
2 parents 233899a + 2424477 commit 393eb9d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/components/formit/src/FormIt/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,13 @@ public function isNumber($key,$value) {
* @return boolean
*/
public function isDate($key,$value,$format = '%m/%d/%Y') {
$ts = false;
if (!empty($value)) {
$ts = strtotime($value);
/* allow empty isDate, :required should be used to prevent blank field */
if (empty($value)) {
return true;
}
if ($ts === false || empty($value)) {

$ts = strtotime($value);
if ($ts === false) {
return $this->_getErrorMessage($key,'vTextIsDate','formit.not_date',array(
'format' => $format,
'field' => $key,
Expand Down

0 comments on commit 393eb9d

Please sign in to comment.