-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Correctly formatting DateAxisItem ticks in different timezones #1389
Comments
Here is my implementation: https://gist.github.com/NomAnor/1eb616c950a4154793bd6c235038ebfb It adds an additional dependency on My implementation:
In some cases using non-aligning If I get positive feedback from the developers I will create a pull request. |
hey @NomAnor sorry I didn't follow up w/ this earlier. @2xB was the maintainer that largely drove the effort for DateAxisItem; and he's had a leave of absence, ...we're a bit reluctant to introduce dependencies, but if you are able to structure the use of Furthermore, if you add some test code to test this functionality; we'll feel even better about it 😆 I am looking over you gist, and I'm not seeing any major issue with it (well, besides its not py2 compatible, but we can worry about that later); but likely I would experiment with it a bit, which having a PR handy would make it easier for me to do so. Thanks for creating the issue! |
Sorry for answering late, I'm not consistently working on this project. Anyways: Implementing Daylight Saving Times in First, Then, I would try to keep the PR minimal. Don't get me wrong, I really appreciate the overhaul you did! Just the more one changes, the more has to be checked for possible implications. We had quite many comments in the original So all in all great work, and depending on whether you can afford this time-wise, I'd suggest to use the knowledge gained from this to make a PR touching less code and being more backwards-compatible. Thank you again for the work done so far! |
That may make it bit difficult to implement. If I have time, I look into it and create a PR when I have a working prototype. |
Short description
Formatting of of ticks is not correct when the output format should be in a timezone != UTC.
Code to reproduce
Expected behavior
On
2020-10-25 03:00 CEST
Germany changes back to2020-10-25 02:00 CET
so the Axisshould show two ticks with the same time one hour apart. The first tick represents
2020-10-25 02:00 CEST
, the second2020-10-25 02:00 CET
.Real behavior
The ticks show
02:00
followed by03:00
Tested environment(s)
Additional context
Using the
utcOffset
Parameter can't give the correct behaviour because the offset changes depending on the timepoint.Shifting the posix timestamp values by some offset is not the correct way to translate to different
timezones. Posix timestamps are not timezone aware, they always represent the seconds after the epoch
1970-01-01 00:00 UTC
.It's easiest to show for DST transitions but the same applies for all timezones because
the timezone offsets can change irregularly.
My example code shows the normal
DateAxisItem
on the bottom and simple patched one on the topwhich shows the correct behaviour.
I've briefly look into how the
utcOffset
is used in calculating the tick values. I would expect the ticksto line up with the local time (e.g. a tick every full hour). This is not the case, because
there are timezones with offsets that are not multiples of one hour (e.g.
UTC+05:45
used in Nepal).Maybe I misunderstood the purpose of the
utcOffset
parameter, the documentation is missing for it.Resolution
For my current project I have to implement a correct
AxisItem
so I could create a pull request.What should be the interface? Can the current
DateAxisItem
be changed or should a newAxisItem
be introduced?I think something like
NewDateAxisItem(timezone=None, zoomLevels=None, **kwargs)
. TimezoneNone
means the local timezone, same as indatetime
.None
for zoomLevels means the default zoom levels similiar to the current.These would be the main customization points without the need to subclass.
The documentation should show an example how to correctly create posix timestamps from datetime objects.
The text was updated successfully, but these errors were encountered: