diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertAdminCustomerDateOfBirthValidationMessageActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertAdminCustomerDateOfBirthValidationMessageActionGroup.xml new file mode 100644 index 0000000000000..03682f9232eab --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertAdminCustomerDateOfBirthValidationMessageActionGroup.xml @@ -0,0 +1,25 @@ + + + + + + + Fills 'Date of Birth' input with provided 'dob' value, clicks 'save' button, checks + there is no provided validation error message for the 'Date of Birth' input on the page. + + + + + + + + + + + diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountInformationSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountInformationSection.xml index 2c9e66c15bbab..50e923d9b32cc 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountInformationSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountInformationSection.xml @@ -36,5 +36,6 @@ + diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDateOfBirthValidationForFranceDateFormatTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDateOfBirthValidationForFranceDateFormatTest.xml new file mode 100644 index 0000000000000..78a1d122d59d4 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDateOfBirthValidationForFranceDateFormatTest.xml @@ -0,0 +1,36 @@ + + + + + + + + + <group value="customer"/> + <group value="ui"/> + </annotations> + <before> + <magentoCLI command="setup:static-content:deploy fr_FR" stepKey="deployStaticContentWithFrenchLocale"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminInterfaceLocaleToFrance"> + <argument name="InterfaceLocaleByValue" value="fr_FR"/> + </actionGroup> + </before> + + <after> + <actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminInterfaceLocaleToDefaultValue"> + <argument name="InterfaceLocaleByValue" value="en_US"/> + </actionGroup> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + + <actionGroup ref="AdminNavigateNewCustomerActionGroup" stepKey="navigateToNewCustomerPage"/> + <actionGroup ref="AssertAdminCustomerDateOfBirthValidationMessageActionGroup" stepKey="assertDateOfBirthValidationMessage"/> + </test> +</tests> diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index 825b7f4a0546e..f9778ad8d688c 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/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.') ]