Skip to content

Commit c7f318c

Browse files
committed
Fix dob date validation on custom locale
1 parent f0baa28 commit c7f318c

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,24 +209,16 @@ public function getHtmlId()
209209
public function getHtmlExtraParams()
210210
{
211211
$validators = [];
212-
$validators['required'] = true;
213-
$validators['validate-date'] = [
214-
'dateFormat' => $this->getDateFormat()
215-
];
216-
217-
return 'data-validate="' . $this->_escaper->escapeHtml(json_encode($validators)) . '"';
218-
219-
$extraParams = [
220-
"'validate-date':true",
221-
];
222212

223213
if ($this->isRequired()) {
224-
$extraParams[] = 'required:true';
214+
$validators['required'] = true;
225215
}
226216

227-
$extraParams = implode(', ', $extraParams);
217+
$validators['validate-date'] = [
218+
'dateFormat' => $this->getDateFormat()
219+
];
228220

229-
return 'data-validate="{' . $extraParams . '}"';
221+
return 'data-validate="' . $this->_escaper->escapeHtml(json_encode($validators)) . '"';
230222
}
231223

232224
/**

lib/web/mage/validation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@
973973
return $.mage.isEmptyNoTrim(value) || test.isValid();
974974
},
975975
$.mage.__('Please enter a valid date.')
976+
976977
],
977978
'validate-date-range': [
978979
function (v, elm) {

0 commit comments

Comments
 (0)