Skip to content

Fix traffic chart date labels across timezones - #621

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
BharadwajKanneveti:fix/traffic-chart-utc-date-labels
Aug 3, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
BharadwajKanneveti:fix/traffic-chart-utc-date-labels

Conversation

@BharadwajKanneveti

Copy link
Copy Markdown
Contributor

Summary

Fix the AI Traffic trend chart date labels shifting by one day in negative UTC-offset timezones.

The chart buckets visits by UTC day on the server using YYYY-MM-DD keys, but the frontend was parsing those bucket keys with new Date() and formatting them in the browser's local timezone. This caused dates like 2026-08-01 to display as Jul 31 in regions such as America/Los_Angeles.

Changes:

  • Added a shared helper to format traffic bucket dates using timeZone: 'UTC'.
  • Updated the X-axis formatter to preserve the UTC bucket date.
  • Updated the custom tooltip to use the same formatted date instead of displaying the raw ISO date.
  • Changed locale handling from hardcoded 'en' to undefined so it follows the user's browser locale.

Related issue

Closes #605

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly the right fix — one UTC-pinned helper shared by the axis and tooltip. Thanks!

@gkhngyk
gkhngyk merged commit 12e47ad into ansvisor:main Aug 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI Traffic: trend chart shows the wrong day in negative-UTC timezones; tooltip prints raw ISO dates

2 participants