everybody. I have a small task on unknown product. Need to change date format at order list in Shopware 6. Now it looks like: 22/06/21, 22:23
I want to show date only, without time.
In SW docs found guide
In SW source found template for order list screen: shopware\vendor\shopware\administration\Resources\app\administration\src\module\sw-order\page\sw-order-list\sw-order-list.html.twig
with code for date column:
{% block sw_order_list_grid_columns_order_date %}
<template #column-orderDateTime="{ item }">
{{ item.orderDateTime | date({hour: '2-digit', minute: '2-digit'}) }}
</template>
{% endblock %}
In my plugin added new component: plugins\MyPlugin\src\Resources\app\administration\src\core\component\sw-order-list-override
with new template "sw-order-list.html.twig":
{% block sw_order_list_grid_columns_order_date %}
{{ item.orderDateTime | format_date('medium') }}
{% endblock %}
and with new "index.js":
import template from './sw-order-list.html.twig';
const { Component } = Shopware;
Component.override('sw-order-list', {
template
});
Into "plugins\MyPlugin\src\Resources\app\administration\src\main.js" added:
import './core/component/sw-order-list-override/';
At SW host rebuilded administration, reloaded order screen list in browser and screen was changed BUT not as expected. Now order date looks like ISO date: 2021-07-13T00:08:21.413+00:00
What is wrong in my code?
I've even added something like this in override template
{% block sw_order_list_grid_columns_order_date %}
TEST TEXT
{% endblock %}
But did not see "TEST TEXT" in order date column, but the same ISO format date.