Skip to content

Commit 79f8f11

Browse files
author
Roman Lytvynenko
committed
MAGETWO-99832: Order grid saved view with Purchased date show Invalid date after switching views
1 parent 067819d commit 79f8f11

File tree

1 file changed

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

1 file changed

+6
-17
lines changed

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

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,7 @@ define([
7676
*
7777
* @type {String}
7878
*/
79-
shiftedValue: '',
80-
81-
/**
82-
* Stored Date format initially received from server
83-
* for offline date formatting
84-
*
85-
* @private
86-
* @type {String}
87-
*/
88-
storedDateFormat: ''
79+
shiftedValue: ''
8980
},
9081

9182
/**
@@ -130,18 +121,16 @@ define([
130121
if (this.options.showsTime) {
131122
shiftedValue = moment.tz(value, 'UTC').tz(this.storeTimeZone);
132123
} else {
133-
if (this.storedDateFormat) {
134-
dateFormat = this.storedDateFormat;
135-
} else {
136-
dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat;
137-
this.storedDateFormat = dateFormat;
138-
}
124+
dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat;
139125
shiftedValue = moment(value, dateFormat);
140126
}
141127

128+
if (!shiftedValue.isValid()) {
129+
shiftedValue = moment(value, this.inputDateFormat);
130+
}
142131
shiftedValue = shiftedValue.format(this.pickerDateTimeFormat);
143132
} else {
144-
shiftedValue = '';
133+
shiftedValue = this.shiftedValue();
145134
}
146135

147136
if (shiftedValue !== this.shiftedValue()) {

0 commit comments

Comments
 (0)