We have an issue with using New From Date as filter in product grid
Steps - on admin go to products > catalog - in columns make sure you have 'set product as new from date' selected - in filters apply a date range in new from date - click into a product and save and close
expected result: - inputted data in filter fields remains the same
actual result: - inputted data in date fields changes to one in the past, though the results seem to be correct.
Not sure if this is a M2 bug, has anyone experienced it or try to replicate?
UPDATE
So it seems there is a problem with this function
dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat;
/**
* Prepares and sets date/time value that will be displayed
* in the input field.
*
* @param {String} value
*/
onValueChange: function (value) {
var dateFormat,
shiftedValue;
if (value) {
if (this.options.showsTime) {
shiftedValue = moment.tz(value, 'UTC').tz(this.storeTimeZone);
} else {
dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat;
shiftedValue = moment(value, dateFormat);
}
shiftedValue = shiftedValue.format(this.pickerDateTimeFormat);
} else {
shiftedValue = '';
}
if (shiftedValue !== this.shiftedValue()) {
this.shiftedValue(shiftedValue);
}
},
seems it's not able to retrieve the shiftedValue so it uses this.inputDateFormat (YYYY-MM-DD)
instead of this.outoutDateFormat (MM/DD/YYYY)
replacing it as
dateFormat = this.shiftedValue() ? this.outputDateFormat : this.outputDateFormat;
works.
Any idea to fix properly the bug?