mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2152 from dhensby/patch-1
FIX Empty Datefield with defined min or max has non-object error thrown
This commit is contained in:
commit
d291a96326
@ -369,7 +369,7 @@ class DateField extends TextField {
|
||||
} else {
|
||||
$minDate = new Zend_Date(strftime('%Y-%m-%d', strtotime($min)), $this->getConfig('datavalueformat'));
|
||||
}
|
||||
if(!$this->valueObj->isLater($minDate) && !$this->valueObj->equals($minDate)) {
|
||||
if(!$this->valueObj || (!$this->valueObj->isLater($minDate) && !$this->valueObj->equals($minDate))) {
|
||||
$validator->validationError(
|
||||
$this->name,
|
||||
_t(
|
||||
@ -390,7 +390,7 @@ class DateField extends TextField {
|
||||
} else {
|
||||
$maxDate = new Zend_Date(strftime('%Y-%m-%d', strtotime($max)), $this->getConfig('datavalueformat'));
|
||||
}
|
||||
if(!$this->valueObj->isEarlier($maxDate) && !$this->valueObj->equals($maxDate)) {
|
||||
if(!$this->valueObj || (!$this->valueObj->isEarlier($maxDate) && !$this->valueObj->equals($maxDate))) {
|
||||
$validator->validationError(
|
||||
$this->name,
|
||||
_t('DateField.VALIDDATEMAXDATE',
|
||||
|
Loading…
Reference in New Issue
Block a user