mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Merge pull request #88 from JustinHook/invalid-dateformat
Fixes #64. Updated validateDateFormat
This commit is contained in:
commit
40796c2acd
@ -517,7 +517,7 @@ class Validator
|
||||
{
|
||||
$parsed = date_parse_from_format($params[0], $value);
|
||||
|
||||
return $parsed['error_count'] === 0;
|
||||
return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -449,6 +449,10 @@ class ValidateTest extends BaseTestCase
|
||||
$v = new Validator(array('date' => 'no thanks'));
|
||||
$v->rule('dateFormat', 'date', 'Y-m-d');
|
||||
$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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user