diff --git a/app/code/Magento/Customer/Block/Widget/Dob.php b/app/code/Magento/Customer/Block/Widget/Dob.php index 74b9a9c9af29b..f8ee8fddf2ea2 100644 --- a/app/code/Magento/Customer/Block/Widget/Dob.php +++ b/app/code/Magento/Customer/Block/Widget/Dob.php @@ -209,24 +209,16 @@ public function getHtmlId() public function getHtmlExtraParams() { $validators = []; - $validators['required'] = true; - $validators['validate-date'] = [ - 'dateFormat' => $this->getDateFormat() - ]; - - return 'data-validate="' . $this->_escaper->escapeHtml(json_encode($validators)) . '"'; - - $extraParams = [ - "'validate-date':true", - ]; if ($this->isRequired()) { - $extraParams[] = 'required:true'; + $validators['required'] = true; } - $extraParams = implode(', ', $extraParams); + $validators['validate-date'] = [ + 'dateFormat' => $this->getDateFormat() + ]; - return 'data-validate="{' . $extraParams . '}"'; + return 'data-validate="' . $this->_escaper->escapeHtml(json_encode($validators)) . '"'; } /** diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index f99cdc8886808..85158c581aec1 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -973,6 +973,7 @@ return $.mage.isEmptyNoTrim(value) || test.isValid(); }, $.mage.__('Please enter a valid date.') + ], 'validate-date-range': [ function (v, elm) {