Skip to content

fix: correct date axis timezone in hoveranywhere/clickanywhere events - #7818

Open
godfengliang wants to merge 1 commit into
plotly:masterfrom
godfengliang:fix-date-p2c-timezone
Open

fix: correct date axis timezone in hoveranywhere/clickanywhere events#7818
godfengliang wants to merge 1 commit into
plotly:masterfrom
godfengliang:fix-date-p2c-timezone

Conversation

@godfengliang

Copy link
Copy Markdown

Fixes #7816.

For date axes, p2c returns a display-time value (local-time components encoded as UTC ms). This caused hoveranywhere and clickanywhere events to report timestamps shifted by the local timezone offset.

Fix: after p2c for date axes, apply timezone correction to convert back to true UTC ms.

@camdecoster

Copy link
Copy Markdown
Contributor

Thanks for the PR! Our team is taking a look at this area of the code, so we'll review your PR in tandem and follow up with you.

@emilykl

emilykl commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@godfengliang Thank you for this PR, as it prompted us to look more closely at this issue.

The proposed fix addresses the immediate issue, but it's not consistent with conventions that we use elsewhere in plotly.js. Milliseconds in plotly.js are always in the local time zone; timezone-agnostic times are only provided as date strings. (This is probably a bad pattern, but changing it would require a larger refactor of the library.)

I've opened #7964 with a fix that's more consistent with the way the rest of plotly.js behaves. I'll leave this PR open while discussion continues over there, but I think we'll most likely end up pursuing an approach along those lines rather than this one.

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.

[BUG]: hoveranywhere / clickanywhere return incorrect timestamps for date axes with local time zones

3 participants