From 1d84cab42e4e8fa124bc7c2e96449f54239f6e93 Mon Sep 17 00:00:00 2001 From: Dmytro Voskoboinikov <dvoskoboinikov@ebay.com> Date: Fri, 1 Apr 2016 18:22:55 +0300 Subject: [PATCH] MAGETWO-49314: Magento/Ui datepickers do not consider Magento timezone settings --- .../Ui/view/base/web/js/form/element/date.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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 63953173bdc..f6b86377d6f 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); -- GitLab