utc to the schema and the docsutc: boolean property scale.md that uses utc scale. We should not use UTC for the output because dates are parsed using the current time zone. When we add a way to parse dates as UTC, then we should also output them as UTC.
Right now, nothing is parsed or shown in UTC.
We should add an option to parse and view in UTC but it's not urgent so I'll leave this.
Yes. Modulo some weird js behavior. See https://github.com/vega/datalib/issues/63
Seems like a major usability issue. Could this be as simple as offering the user a switch and using the .utc time scales in d3?
Actually I just checked, you can use utc as a scale type too, we just haven't updated the docs.
Actually I just checked, you can use utc as a scale type too, we just haven't updated the docs.
It's more than that. We also have to make sure that all the timeUnit stuff works with utc.
Actually I just checked, you can use utc as a scale type too, we just haven't updated the docs.
Like this? I'm getting strange results for the X axis. Not sure if this is what @domoritz meant.
Yeah, like that. We simply haven't tested it properly. UTC is a new feature that is currently not supported but implementing it should only require a few adjustments.
Yeah, that's mainly why we haven't added it in http://vega.github.io/vega-lite/docs/scale.html#type yet
We should add an option to parse and view in UTC but it's not urgent so I'll leave this.
Is there really an easy way to parse things in UTC? AFAIK the parse behavior depends on the input data and the specified parse format.
In any case, I think the option to output UTC correctly is extremely crucial.
This issue seems relevant: https://github.com/vega/vega/issues/741
From the discussion with @kanitw, we try to analyze the design space related to UTC, which involves both input and output.
There are two cases:
1) format:"auto". Normally it parses date in local time, but if the data follows ISO format, it parses data in UTC (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
2) custom format:
"date:format""utc:format"From preliminary exploration, Zoe thinks that:
1) If the input is already read as UTC, using normal time scale and normal time expression for timeUnit, would show UTC values.
2) If the input is read as local time, users may wanna use utc scale and utc time expression for timeUnit to show UTC values.
[x] test how Vega stores date (Date object or just timestamp)
0)[ ] Create an example data where time/utc scale type matters
A few alternatives to let VL correctly add “utc” prefix to timeUnit:
We definitely need the latter. Then should the former be automatically inferred from the scale type or do we include it as a part of timeUnit but throw an error for inconsistent state (if it needs to be consistent.)
Most helpful comment
From the discussion with @kanitw, we try to analyze the design space related to UTC, which involves both input and output.
INPUT
There are two cases:
1)
format:"auto". Normally it parses date in local time, but if the data follows ISO format, it parses data in UTC (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).2) custom
format:"date:format"utc time use
"utc:format"OUTPUT
From preliminary exploration, Zoe thinks that:
1) If the input is already read as UTC, using normal time scale and normal time expression for timeUnit, would show UTC values.
2) If the input is read as local time, users may wanna use utc scale and utc time expression for timeUnit to show UTC values.
TODO
[x] test how Vega stores date (Date object or just timestamp)
0)[ ] Create an example data where time/utc scale type matters
SYNTAX
A few alternatives to let VL correctly add “utc” prefix to timeUnit:
We definitely need the latter. Then should the former be automatically inferred from the scale type or do we include it as a part of timeUnit but throw an error for inconsistent state (if it needs to be consistent.)