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.

enter image description here Not sure if this is a M2 bug, has anyone experienced it or try to replicate?


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,

        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()) {

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;


Any idea to fix properly the bug?

1 Answer 1


this workaround in date.js fixed our case

var dateRegexp='(0[1-9]|1[012])[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](19|20)\\d\\d';`

if (value.match(dateRegexp)){

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.