diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 63953173bdc86751a7f85cacebed3286819186c7..f6b86377d6fd2fcd095b2c22ba4dd0802ad8a3d0 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -75,13 +75,11 @@ define([ initConfig: function () { this._super(); - var options = { + utils.extend(this.options, { showsTime: this.showsTime, timeFormat: this.timeFormat, dateFormat: this.dateFormat - }; - - utils.extend(this.options, options); + }); this.prepareDatetimeFormats(); @@ -102,17 +100,16 @@ define([ * @param {String} value */ onValueChange: function (value) { - var shiftedValue; + var dateFormat, + shiftedValue; if (value) { if (this.showsTime) { shiftedValue = moment.utc(value).add(this.timeOffset, 'seconds'); } else { - shiftedValue = moment(value, this.outputDateFormat); + dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; - if (!this.shiftedValue()) { - shiftedValue = moment(value, this.inputDateFormat); - } + shiftedValue = moment(value, dateFormat); } shiftedValue = shiftedValue.format(this.datetimeFormat);