mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-31 07:01:54 +00:00
Fixes #64. Updated validateDateFormat to use warning_count for validation check
This commit is contained in:
parent
e3c24cbf21
commit
9b5b0cff77
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user