cancel
Showing results for 
Search instead for 
Did you mean: 

Inline date editing changes date on save

Inline date editing changes date on save

Apologies if this is covered elsewhere, I may not be searching for the correct issue.

Having an issue with inline editing date columns where on saving, the value is saved into the database correctly but displays incorrectly to the user. For example, the column created by this XML:

 

 <column name="start_date" class="Magento\Ui\Component\Listing\Columns\Date">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">dateRange</item>
                    <item name="dataType" xsi:type="string">date</item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
                    <item name="editor" xsi:type="string">date</item>
                    <item name="label" xsi:type="string" translate="true">Start Date</item>
                </item>
            </argument>
        </column>

 

Will allow me to select a start_date value of, say, "06/30/2017", which, on saving, will store correctly in the database as "06/30/2017", but will display to the user as "June 29, 2017 7:00:00 PM". If I edit and save again without changing the value, it subtracts 5 hours from the timestamp and saves the previously displayed value in the db (so the db value becomes "June 29, 2017 7:00:00 PM" and the displayed timestamp becomes "June 29, 2017 2:00:00 PM"). This will stack as many times as you'd save it.

 

If it were just this, I'd figure I'd have a disconnect in timezone somewhere, but as an added wrinkle, sometimes on page refresh, the column will randomly retrieve "1/4/2000".

 

Mostly just trying to figure out if this is a known bug or if I've setup something incorrectly. Any help would be greatly appreciated.

1 REPLY

Re: Inline date editing changes date on save

This belongs in the Magento 2 Technical Issues forum, apologies for putting it in the wrong place.