UTC timeunits do not return UTC times in Vega-Lite 4.0
See original GitHub issueIn 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:
{
"data": {"values": [{"t": "2020-01-01T12:00:00-08:00"}]},
"mark": "point",
"encoding": {
"x": {"type": "temporal", "field": "t", "timeUnit": "hours", "title": "hours"},
"y": {"type": "temporal", "field": "t", "timeUnit": "utchours", "title": "utchours"}
}
}
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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
UTC timeunits do not return UTC times in Vega-Lite 4.0 -
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.
Read more >Time Unit | Vega-Lite
To output data in UTC time, we can specify either a UTC time unit or scale: UTC time unit when input data is...
Read more >Date parsing and when to use utc/TimeUnits in Vega Lite?
Dates are always displayed in local time, unless otherwise specified (e.g. by passing "utc": true to a timeUnit); Dates are parsed using ...
Read more >Graphics.Vega.VegaLite - Hackage
It was originally based on version 2.2.1 but it has been updated to match later versions. This module allows users to create a...
Read more >Interaction / UW Interactive Data Lab - Observable
CC BY 4.0 ... If no interval is defined (the selection is empty), Vega-Lite ... as time 0 , and thus map to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@SyntaxRules It looks like the issue has to do with the inconsistent parsing of the Date object (see here). In the spec, data is given in
year-month-day
format, which is interpreted in UTC. The datetime objects provided as tick values are interpreted in local time. If we switch to the same formatting: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.
@SyntaxRules After the fix
This seems right since the dates are parsed as local, right?