Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
175 stars 69 forks source link

Reporting: Transactions List - Simplify how time zones are calculated and passed on #9184

Open nagpai opened 4 months ago

nagpai commented 4 months ago

Describe the bug

( This is a WIP draft. Details and links are yet to be plugged in ) The transaction cache on the server saves time stamps in UTC.

The transactions list in reports ( Payment > Transactions ) and all other reports that use it ( e.g. Payment activity widget ), shows the time in the website time zone.

The filter queries, that are in the same website time zone, are eventually converted to UTC while querying the transaction cache. We however see this is done in a complex way where there is also user's local browser time zone involved.

We need to explore if getting the user's browser time zone is indeed required, or if there is a scope to simplify this further.

Additional context

haszari commented 3 months ago

@nagpai this issue is quite vague and hard to action. How can we make it clearer and more actionable?

Here's my understanding:

https://github.com/Automattic/woocommerce-payments/blob/bebe14e87eb2a4604c82dd212221efc1854302c1/includes/core/server/request/class-list-transactions.php#L80-L81

https://github.com/Automattic/woocommerce-payments/blob/bebe14e87eb2a4604c82dd212221efc1854302c1/includes/core/server/request/class-list-deposits.php#L48-L50

https://github.com/Automattic/woocommerce-payments/blob/bebe14e87eb2a4604c82dd212221efc1854302c1/includes/core/server/request/class-list-disputes.php#L54-L56

https://github.com/Automattic/woocommerce-payments/blob/bebe14e87eb2a4604c82dd212221efc1854302c1/includes/core/server/request/class-list-documents.php#L46-L48