fix: correct date axis timezone in hoveranywhere/clickanywhere events - #7818
fix: correct date axis timezone in hoveranywhere/clickanywhere events#7818godfengliang wants to merge 1 commit into
Conversation
|
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. |
|
@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. |
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.