Closed
Description
Preconditions (*)
- Magento 2.3.4 (but probably on previous versions also)
- Login to admin
- Have locale set to en_GB (UK) for the user
Steps to reproduce (*)
- Edit a customer
- Select a date of birth after 12th of a month this year
Expected result (*)
- Date of birth is valid, you can save the customer
Actual result (*)
- Validation error happens "The Date of Birth should not be greater than today" because instead of DD/MM/YYYY the date is treated as MM/DD/YYYY
Here is a small composer patch I wrote for this:
--- a/view/base/web/js/lib/validation/rules.js
+++ b/view/base/web/js/lib/validation/rules.js
@@ -1069,12 +1069,12 @@ define([
$.mage.__('This link is not allowed.')
],
'validate-dob': [
- function (value) {
+ function (value, param, params) {
if (value === '') {
return true;
}
- return moment(value).isBefore(moment());
+ return moment.utc(value, params.dateFormat).isSameOrBefore(moment.utc());
},
$.mage.__('The Date of Birth should not be greater than today.')
]
--
2.17.1
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.4-develop branchGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentIndicates original Magento version for the Issue report.The issue has been reproduced on latest 2.4-develop branch