Skip to content

Commit 3ba577e

Browse files
committed
MAGETWO-59718: Date sets to 2020 year after save
- Fixed javascript issues.
1 parent 7b894b4 commit 3ba577e

File tree

2 files changed

+9
-5
lines changed
  • app/code/Magento/Ui/view/base/web/js/form/element
  • dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist

2 files changed

+9
-5
lines changed

app/code/Magento/Ui/view/base/web/js/form/element/date.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ define([
166166
*/
167167
prepareDateTimeFormats: function () {
168168
this.pickerDateTimeFormat = this.options.dateFormat;
169-
this.momentFormat = (this.options.dateFormat) ? this.convertToMomentFormat(this.options.dateFormat) : this.momentFormat;
169+
this.momentFormat = this.options.dateFormat ?
170+
this.convertToMomentFormat(this.options.dateFormat) : this.momentFormat;
171+
170172
if (this.options.showsTime) {
171173
this.pickerDateTimeFormat += ' ' + this.options.timeFormat;
172174
}
@@ -184,15 +186,18 @@ define([
184186
},
185187

186188
/**
187-
* @param format PHP Format
188-
* @returns {String} Moment compatible format
189+
* Converts PHP IntlFormatter format to moment format.
190+
*
191+
* @param {String} format - PHP format
192+
* @returns {String} - moment compatible formatting
189193
*/
190-
convertToMomentFormat: function (format){
194+
convertToMomentFormat: function (format) {
191195
var newFormat;
192196

193197
newFormat = format.replace(/yy|y/gi, 'YYYY'); // replace the year
194198
newFormat = newFormat.replace(/dd|d/g, 'DD'); // replace the date
195199
newFormat = newFormat.replace(/mm|m/g, 'MM'); //replace the month
200+
196201
return newFormat;
197202
}
198203
});

dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,6 @@ vendor/magento/module-ui/view/base/web/js/form/components/html.js
923923
vendor/magento/module-ui/view/base/web/js/form/components/tab_group.js
924924
vendor/magento/module-ui/view/base/web/js/form/components/tab.js
925925
vendor/magento/module-ui/view/base/web/js/form/element/abstract.js
926-
vendor/magento/module-ui/view/base/web/js/form/element/date.js
927926
vendor/magento/module-ui/view/base/web/js/form/element/helpers/options.js
928927
vendor/magento/module-ui/view/base/web/js/form/element/multiselect.js
929928
vendor/magento/module-ui/view/base/web/js/form/element/post-code.js

0 commit comments

Comments
 (0)