-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use local time for column/row headers and computed functions #1074
Conversation
… paths print the current timezone and local time consistent with data
…date.h for proper date formatting
…roperly documented
Is it possible to have both behaviours implemented and be able to choose? |
Which behaviours are you referring to exactly? For the computed functions, even though it would be possible to preserve the old behaviour of UTC, it just isn't correct when compared with the underlying data: The issue is the same with row headers - we don't have an API for controlling their output from userland (they are generated in the C++ part of the codebase), and UTC output would be inconsistent with the underlying data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This is a fantastic fix.
@andyferris With this change you can present datetime
values in whatever timezone and format you choose, either via perspective-viewer-datagrid
formatting, or the localized datetime
from the perspective
API. I think the important take away is that time-zone relativeness in encoding is now preserved, which is very important as perspective
data on the server and client may be distributed across timezone. If you have any questions about this or have suggestions for how to improve this API, I encourage you to open a new Issue to describe it - we are very interested in feedback on this topic!
This PR fixes several issues with computed functions and computed columns in
perspective-python
:hour_of_day
,day_of_week
, andmonth_of_year
functions now use local time to perform their calculations. Previously, all calculations were in UTC which could cause issues with datetimes that were on the cusp of one day/month to the next, as well as returning the wrong hour of day when compared with the input column.