How should I be encoding dates and times?

Viewed 18

I'm converting date columns from an internal date/time format to something Vega-Lite can parse, and am uncertain what my target should be. In version 4, there was a date time definition object, that went something like this {"year": 2006, "month": "jan", "date": 1}, and I seem to remember that working. However some recent plots fail silently when I do that, and I seem to need to use ISO-8601 string formats.

What's the proper way to encode a date and time column in version 5?

1 Answers

You can specify a format object with a parse property to parse your dates in whatever format they're in.

https://vega.github.io/vega-lite/docs/data.html

Specific date formats can be provided (e.g., {foo: "date:'%m%d%Y'"}), using the d3-time-format syntax.

Related