Skip to content

Commit c18a2ed

Browse files
committed
adding new validation for future dates to admin in customer DOB
1 parent 3fe8a17 commit c18a2ed

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/code/Magento/Customer/view/base/ui_component/customer_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
</argument>
265265
<settings>
266266
<validation>
267-
<rule name="validate-date" xsi:type="boolean">true</rule>
267+
<rule name="validate-dob" xsi:type="boolean">true</rule>
268268
</validation>
269269
<dataType>text</dataType>
270270
<visible>true</visible>

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,16 @@ define([
10671067
return new RegExp(param).test(value);
10681068
},
10691069
$.mage.__('This link is not allowed.')
1070+
],
1071+
'validate-dob': [
1072+
function (value, params, additionalParams) {
1073+
if(value === '') {
1074+
return true;
1075+
}
1076+
1077+
return moment(value).isBefore(moment());
1078+
},
1079+
$.mage.__('The Date of Birth should not be greater than today')
10701080
]
10711081
}, function (data) {
10721082
return {

0 commit comments

Comments
 (0)