-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
UTC timeunits do not return UTC times in Vega-Lite 4.0 #5777
Comments
Examining the generated Vega output, I see that the |
Thank you for the report and helpful details! I think I know where the issue is—the switch to vega time format was incomplete. Addressing today. |
I made a PR, #5780 . When utc timeunits are specified, the fix creates compiled vega such that:
An inconsistency I'm noticing. With the spec Jake provided, (1) and (2) are not necessary as long as (3) is true. What's more, if (1) and (2) are true but not (3), the result is incorrect (still local timezone). Is this okay for normalization's sake? |
I think I found another manifestation of this same issue, and may be fixed by @haldenl 's PR. I'll post the details here, let me know if this is a separate issue and I'll open up a different one. Marks on the following chart are on the 1st and 15th of each month, but don't align with the axis marks. The marks are suppose to be in "timeFormat": "utcyearmonthdate" but show off by one. I wait until the PR is ready, then try out the fix. |
@SyntaxRules After the fix This seems right since the dates are parsed as local, right? |
@domoritz Its closer 😄 ! What I'm expecting is the rule mark on "2020-01-01" to match exactly with the axis tick mark on "2020-01-01". In this use case I really do not care about what timezone the user is in, I always want the rule mark to line up. I pulled up a editor with vega-lite 3.2.1 and this is what I got: This is what I expect; The marks align perfectly with the axis. 3.2.1 is giving me the desired chart. |
Isn't that incorrect in vl 3.2.1? Your dates are midnight in local time (unless you are in UTC). Your scale and axis are in UTC on the other hand. |
@SyntaxRules
The output is as expected (on the fix branch). I wonder if something changed with datetime usage between 3.2.1 and 4.0. Will investigate. |
In Vega-Lite 4.0, UTC timeunits return the same value as their non-UTC counterparts. This was not the case in Vega-Lite 3.X
Here is a simple spec that demonstrates this:
I viewed this on a computer set to the US/Pacific timezone.
With Vega-Lite 3.4.0 & Vega 5.9.1, I see the expected result: the local hour is 12, and the UTC hour is 20.

With Vega-Lite 4.0.2 & Vega 5.9.1, the result has changed: the UTC timeUnit is the same as the local timeUnit:

This seems to be the case not just for
utchours
but for every UTC timeUnit Vega-Lite supports: each UTC timeUnit returns identical timestamps as its non-UTC counterpart.The text was updated successfully, but these errors were encountered: