From: Matthias Schmidt Date: Sun, 26 Jan 2020 08:14:23 +0000 (+0100) Subject: Fix validation of earliest and latest date in DateFormField X-Git-Tag: 5.2.2~36 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=38c2257c1e88f71ddc41243d72a905581bdcb252;p=GitHub%2FWoltLab%2FWCF.git Fix validation of earliest and latest date in DateFormField --- diff --git a/wcfsetup/install/files/lib/system/form/builder/field/DateFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/DateFormField.class.php index 2e529a48d1..ca3ddb9cde 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/DateFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/DateFormField.class.php @@ -293,8 +293,10 @@ class DateFormField extends AbstractFormField implements IAutoFocusFormField, II 'format', 'wcf.form.field.date.error.format' )); + return; } - else if ($this->getEarliestDate() !== null) { + + if ($this->getEarliestDate() !== null) { $earliestDateTime = \DateTime::createFromFormat($this->getSaveValueFormat(), $this->getEarliestDate()); if ($dateTime < $earliestDateTime) { @@ -315,9 +317,11 @@ class DateFormField extends AbstractFormField implements IAutoFocusFormField, II 'wcf.form.field.date.error.earliestDate', ['earliestDate' => DateUtil::format($earliestDateTime, $format)] )); + return; } } - else if ($this->getLatestDate() !== null) { + + if ($this->getLatestDate() !== null) { $latestDateTime = \DateTime::createFromFormat($this->getSaveValueFormat(), $this->getLatestDate()); if ($dateTime > $latestDateTime) { @@ -336,8 +340,9 @@ class DateFormField extends AbstractFormField implements IAutoFocusFormField, II $this->addValidationError(new FormFieldValidationError( 'minimum', 'wcf.form.field.date.error.latestDate', - ['latestDateTime' => DateUtil::format($latestDateTime, $format)] + ['latestDate' => DateUtil::format($latestDateTime, $format)] )); + return; } } }