Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The date time used as filter for transactions is not correct #9471

Open
Tracked by #9492
shendy-a8c opened this issue Sep 20, 2024 · 2 comments
Open
Tracked by #9492

The date time used as filter for transactions is not correct #9471

shendy-a8c opened this issue Sep 20, 2024 · 2 comments
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.

Comments

@shendy-a8c
Copy link
Contributor

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.

Screenshot 2024-09-20 at 14 10 10

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

  1. Set blog timezone to be different from browser's timezone. wp-admin > Settings > General > Timezone.
  2. Set the date filter on the transaction list page, either before, after, or between.
  3. Debug the value of the filter dates that are passed to server. It should be the UTC of what is input by user, for example, if my timezone is UTC+7 and I choose 2024-09-01 and 2024-09-03, I will be expecting any data between 2024-09-01 00:00:00 and 2024-09-03 23:59:59 in UTC+7, which means 2024-08-31 17:00:00 and 2024-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.

@shendy-a8c shendy-a8c added type: bug The issue is a confirmed bug. focus: reporting needs triage Manually put issue into triage process. labels Sep 20, 2024
@haszari
Copy link
Contributor

haszari commented Sep 24, 2024

Seems like a similar symptom / bug as this earlier report:

And the fix for that, maybe related:

I think we need to review all UI with dates/times before fixing any one of these bugs, so we are 100% clear and aligned, and prevent fixes introducing bugs/inconsistencies.

@haszari
Copy link
Contributor

haszari commented Sep 24, 2024

Marking as medium, since this filtering is likely not often used. It's close to high because of the inaccuracy.

@haszari haszari added priority: medium The issue/PR is medium priority—non-critical functionality loss, minimal effect on usability and removed needs triage Manually put issue into triage process. labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

2 participants