Skip to content

Commit 0e280ea

Browse files
author
Denys Rul
committed
MAGETWO-31689: 'Date Of Birth' is reset to current date on customer form
- Parse date format on initialization.
1 parent 2f74dea commit 0e280ea

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

app/code/Magento/Ui/view/base/layout/ui_components.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
<arguments>
132132
<argument name="js_config" xsi:type="array">
133133
<item name="extends" xsi:type="string">input</item>
134+
<item name="component" xsi:type="string">Magento_Ui/js/form/element/date</item>
134135
<item name="config" xsi:type="array">
135136
<item name="input_type" xsi:type="string">date</item>
136137
</item>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
3+
*/
4+
define([
5+
'moment',
6+
'./abstract'
7+
], function (moment, Abstract) {
8+
'use strict';
9+
10+
return Abstract.extend({
11+
defaults: {
12+
dateFormat: 'MM/DD/YYYY'
13+
},
14+
15+
/**
16+
* Converts initial value to the specified date format.
17+
*
18+
* @returns {String}
19+
*/
20+
getInititalValue: function () {
21+
var value = this._super();
22+
23+
if (value) {
24+
value = moment(value).format(this.dateFormat);
25+
}
26+
27+
return value;
28+
}
29+
});
30+
});

0 commit comments

Comments
 (0)