benvinegar / counterscale

Scalable web analytics you run yourself on Cloudflare
https://counterscale.dev
MIT License
1.52k stars 66 forks source link

Fix bad hourly start timestamp on chart data #75

Closed benvinegar closed 7 months ago

benvinegar commented 7 months ago

Fixes #60

Originally this tried to do some clever tz math inside Analytics Engine, but it doesn't work. Instead just explicitly calculate the utc start time, treat everything as utc, then convert back to local during UI rendering.

Also removes formatDateString because I think it was also doing some implicit timezone conversion in there somewhere. I found dayjs to be more predictable.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.06%. Comparing base (26b539d) to head (72a46cd).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #75 +/- ## ========================================== - Coverage 79.28% 79.06% -0.23% ========================================== Files 18 18 Lines 2269 2245 -24 Branches 148 145 -3 ========================================== - Hits 1799 1775 -24 Misses 465 465 Partials 5 5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.