-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Stop auto-converting timezones to UTC and stripping timezone info #1581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This seems like the right thing to do overall: match the plotly.js API more closely such that the day plotly.js handles timezones more gracefully it'll just flow through.
To try out the dev build:
$ pip install https://13363-14579099-gh.circle-artifacts.com/0/dist/plotly-3.9.0%2B9.gdc776963.tar.gz
Then start your python notebook/script with
from _plotly_future_ import timezones
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
timezonesfuture 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
newplot-1
v4 behavior
newplot-2
cc @nicolaskruchten @chriddyp @alexcjohnson