Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.38k stars 1.97k forks source link

Stats: Traffic page shows chart date for site current date but makes request for device current date #89198

Open staskus opened 2 months ago

staskus commented 2 months ago

Quick summary

The traffic page shows the chart title date for the site's current date (April 4th) but makes API requests (stats/visits) with the device's current date (2024-04-03). The chart then doesn't show the latest data.

Changing the device timezone changes the data on the chart

https://github.com/Automattic/wp-calypso/assets/4062343/b31c98eb-76e0-407e-a30a-5d9edac53748

Compare chart and network request

https://github.com/Automattic/wp-calypso/assets/4062343/36c08beb-437a-4e84-b9fe-b74d7cfbe049

Steps to reproduce

To more easily reproduce the issue from the frontend side:

  1. Make a new site
  2. Make a new post
  3. Visit the site from a private tab / another computer to generate Stats
  4. Open Stats page on WP.com and confirm that the chart shows the correct date and displays views
  5. Change device's timezone so it would be one day behind
  6. Refresh Stats page
  7. Chart still shows the current site date but no views are shown

What you expected to happen

Chart should show the current site date and display the data for the current site date

What actually happened

The chart shows the current site date but displays the data for the current device date

Impact

Some (< 50%)

Available workarounds?

No but the platform is still usable

Platform (Simple and/or Atomic)

No response

Logs or notes

No response

cat-og commented 2 months ago

📌 REPRODUCTION RESULTS

📌 FINDINGS/SCREENSHOTS/VIDEO

📌 ACTIONS

rickmgithub commented 2 months ago

RETEST

Retested this and I think I see what is being demonstrated. If a click was recorded on say 11th April and the user sets their timezone back to 10th April they won't see that click until tomorrow. I replicated this on my device. Therefore the Stats are based on "Device" time and not "Site" time. Marketing as Triaged as I see the issue.