Skip to content

Commit cd85526

Browse files
committed
Merge remote-tracking branch 'tango/MC-36978' into MPI-2020-09-14
2 parents 2e32e4c + 51b77f0 commit cd85526

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

app/code/Magento/Customer/view/frontend/web/js/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define([
1111
$.validator.addMethod(
1212
'validate-date',
1313
function (value, element, params) {
14-
var dateFormat = utils.convertToMomentFormat(params.dateFormat);
14+
var dateFormat = utils.normalizeDate(params.dateFormat);
1515

1616
if (value === '') {
1717
return true;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/* eslint-disable max-nested-callbacks */
7+
define([
8+
'jquery',
9+
'Magento_Customer/js/validation'
10+
], function ($) {
11+
'use strict';
12+
13+
describe('Testing customer DOB validation to tolerate zeroes in the single digit dates', function () {
14+
var params,
15+
dataProvider;
16+
17+
dataProvider = [
18+
{
19+
format: 'M/d/Y',
20+
date: '09/2/18',
21+
expects: true
22+
},
23+
{
24+
format: 'M/DD/Y',
25+
date: '09/2/18',
26+
expects: false
27+
}
28+
];
29+
30+
dataProvider.forEach(function (data) {
31+
it('Test date validation for format ' + data.format, function () {
32+
params = {
33+
'dateFormat': data.format
34+
};
35+
expect($.validator.methods['validate-date']
36+
.call($.validator.prototype, data.date, null, params)).toEqual(data.expects);
37+
});
38+
});
39+
});
40+
});

0 commit comments

Comments
 (0)