The date time used as filter for transactions is not correct #9471
Labels
focus: reporting
priority: medium
The issue/PR is medium priority—non-critical functionality loss, minimal effect on usability
type: bug
The issue is a confirmed bug.
Describe the bug
I found this bug as I was working on #8522.
The dates used as filter that are passed to server are incorrect and this can lead to a misleading result.
The times displayed under the
Date / Time
column are in the blog's timezone (can be set at wp-admin > Settings > General > Timezone).When user chooses the date filter before and after, they expect to filter the date based on their local time (browser's time).
Currently, the filter dates will be passed to PHP in UTC (because of this). Then, WC_REST_Payments_Transactions_Controller::format_transaction_date_with_timestamp() will convert the dates before passing it to server. It will calculate the difference between store's timezone and user browser's timezone, which is incorrect. The server should receive the date in UTC.
To Reproduce
2024-09-01
and2024-09-03
, I will be expecting any data between2024-09-01 00:00:00
and2024-09-03 23:59:59
in UTC+7, which means2024-08-31 17:00:00
and2024-09-03 16:59:59
in UTC.Actual behavior
The filter dates passed to server is UTC + (difference between browser's timezone and store's timezone).
Expected behavior
The filter dates passed to server should be in UTC.
The text was updated successfully, but these errors were encountered: