Fixes #64. Updated validateDateFormat to use warning_count for validation check

This commit is contained in:
Justin Hook 2014-07-26 15:47:50 +01:00
parent e3c24cbf21
commit 9b5b0cff77
2 changed files with 5 additions and 1 deletions

View File

@ -517,7 +517,7 @@ class Validator
{ {
$parsed = date_parse_from_format($params[0], $value); $parsed = date_parse_from_format($params[0], $value);
return $parsed['error_count'] === 0; return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
} }
/** /**

View File

@ -449,6 +449,10 @@ class ValidateTest extends BaseTestCase
$v = new Validator(array('date' => 'no thanks')); $v = new Validator(array('date' => 'no thanks'));
$v->rule('dateFormat', 'date', 'Y-m-d'); $v->rule('dateFormat', 'date', 'Y-m-d');
$this->assertFalse($v->validate()); $this->assertFalse($v->validate());
$v = new Validator(array('date' => '2013-27-01'));
$v->rule('dateFormat', 'date', 'Y-m-d');
$this->assertFalse($v->validate());
} }
public function testDateBeforeValid() public function testDateBeforeValid()