Stop auto-converting timezones to UTC and stripping timezone info #1581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a new v4
timezones
future flag that changes the behavior of datetime serialization in plotly.py.The current (version 3) behavior for datetimes with timezone info is for plotly.py to automatically convert datetimes to UTC and then remove the timezone info during serialization. This has resulted in a lot of confusion over the years (See #209).
The new behavior is for plotly.py to stop performing the UTC conversion and leave the timezone info in the string that is passed along to plotly.js. Plotly.js currently drops the timezone info (plotly/plotly.js#1532) and displays everything in local time, but hopefully at some point in the future Plotly.js will process the timezone info and provide a way to specify the desired display timezone in the figure specification.
Example
v3 behavior
v4 behavior
cc @nicolaskruchten @chriddyp @alexcjohnson