Closed khoailangthang-programing closed 3 years ago
Hi @kamui23. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
We got similar issue on customer_listing. @kamui23 have you managed to find any workaround ?
I think that in
vendor/magento/module-ui/view/base/web/js/grid/columns/date.js
this patch would work
if (!this.timezone) {
this.timezone = this.storeTimeZone;
}
--- a/vendor/magento/module-ui/view/base/web/js/grid/columns/date.js (date 1608163508332)
+++ b/vendor/magento/module-ui/view/base/web/js/grid/columns/date.js (date 1608163508332)
@@ -48,7 +48,7 @@
date = moment.utc(this._super());
- if (!_.isUndefined(this.timezone)) {
+ if (!_.isUndefined(this.timezone) && moment.tz.zone(this.timezone) !== null) {
date = date.tz(this.timezone);
}
Another problem with this is that method
\Magento\Ui\Component\Listing\Columns\Date::prepareDataSource
tires to convert time on backend. Then module-ui/view/base/web/js/grid/columns/date.js would convert that time to UTC and apply the timezone, so we got wrong time on UI grids.
Workaround is to modify \Magento\Ui\Component\Listing\Columns\Date::prepareDataSource method
public function getConfiguration()
{
$config = parent::getConfiguration();
if (!isset($config['timezone'])) {
$config['timezone'] = 'UTC'; //or date_default_timezone_get();
}
return $config;
}
that would also fix problem in JS or just revert JS file to M2.3.4 version
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!
Up
:white_check_mark: Confirmed by @engcom-Oscar
Thank you for verifying the issue. Based on the provided information internal tickets MC-41877
were created
Issue Available: @engcom-Oscar, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Same here, Magento 2.4.3-p1, happens in the admin customer grid, and a custom listing. The customer grid is no longer sorting the records ascending/descending, regardless of which column I click on.
For whoever this helps, I've had the same issue after adding a custom customer attribute of the type date. However, after adding the following as view/adminhtml/ui_component/customer_listing.xml in my module, it works again:
<columns name="customer_columns">
<column name="customer_first_order" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date" sortOrder="320">
<settings>
<timezone>false</timezone>
<dateFormat>MMM d, y</dateFormat>
<skipTimeZoneConversion>true</skipTimeZoneConversion>
<filter>dateRange</filter>
<dataType>date</dataType>
<label translate="true">Customer First Order</label>
<visible>false</visible>
</settings>
</column>
</columns>
My guess is that the skipTimeZoneConversion flag is what helps here
Preconditions (*)
Steps to reproduce (*)
<timezone>false</timezone>
like thisExpected result (*)
Actual result (*)
Note
By the momentjs docs: https://momentjs.com/timezone/docs/ moment.tz() should take a param as region timezone as string instead of bool type (ex: Europe/Madrid)
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.