mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX DateField with setConfig('dmyfields') now validates TRUE for empty values (fixes #5458)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@103450 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
219c5ff893
commit
577857b98c
@ -351,7 +351,7 @@ JS;
|
||||
|
||||
// date format
|
||||
if($this->getConfig('dmyfields')) {
|
||||
$valid = ($this->validateArrayValue($this->value));
|
||||
$valid = (!$this->value || $this->validateArrayValue($this->value));
|
||||
} else {
|
||||
$valid = (Zend_Date::isDate($this->value, $this->getConfig('dateformat'), $this->locale));
|
||||
}
|
||||
|
@ -119,6 +119,12 @@ class DateFieldTest extends SapphireTest {
|
||||
$f->setValue(array('day' => 29, 'month' => 03, 'year' => 2003));
|
||||
$this->assertTrue($f->validate(new RequiredFields()));
|
||||
|
||||
$f->setValue(null);
|
||||
$this->assertTrue($f->validate(new RequiredFields()), 'NULL values are validating TRUE');
|
||||
|
||||
$f->setValue(array());
|
||||
$this->assertTrue($f->validate(new RequiredFields()), 'Empty array values are validating TRUE');
|
||||
|
||||
// TODO Fix array validation
|
||||
// $f = new DateField('Date', 'Date', array('day' => 9999, 'month' => 9999, 'year' => 9999));
|
||||
// $this->assertFalse($f->validate(new RequiredFields()));
|
||||
|
Loading…
Reference in New Issue
Block a user