Skip to content

Commit 1d84cab

Browse files
author
Dmytro Voskoboinikov
committed
MAGETWO-49314: Magento/Ui datepickers do not consider Magento timezone settings
1 parent 141124c commit 1d84cab

File tree

1 file changed

+6
-9
lines changed
  • app/code/Magento/Ui/view/base/web/js/form/element

1 file changed

+6
-9
lines changed

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,11 @@ define([
7575
initConfig: function () {
7676
this._super();
7777

78-
var options = {
78+
utils.extend(this.options, {
7979
showsTime: this.showsTime,
8080
timeFormat: this.timeFormat,
8181
dateFormat: this.dateFormat
82-
};
83-
84-
utils.extend(this.options, options);
82+
});
8583

8684
this.prepareDatetimeFormats();
8785

@@ -102,17 +100,16 @@ define([
102100
* @param {String} value
103101
*/
104102
onValueChange: function (value) {
105-
var shiftedValue;
103+
var dateFormat,
104+
shiftedValue;
106105

107106
if (value) {
108107
if (this.showsTime) {
109108
shiftedValue = moment.utc(value).add(this.timeOffset, 'seconds');
110109
} else {
111-
shiftedValue = moment(value, this.outputDateFormat);
110+
dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat;
112111

113-
if (!this.shiftedValue()) {
114-
shiftedValue = moment(value, this.inputDateFormat);
115-
}
112+
shiftedValue = moment(value, dateFormat);
116113
}
117114

118115
shiftedValue = shiftedValue.format(this.datetimeFormat);

0 commit comments

Comments
 (0)