This seems like it should be trivial. I want to use d3.time.scale()
to get an array of evenly spaced dates that covers a certain range of time. For example, yea
Using the Date() constructor doesn't work reliably -- it basically depends on the browser. It's much safer to parse explicitly. The constructor doesn't parse as such.
Instead of
var dates = getDates().map(function(d) { return new Date(d) });
use this:
var dates = getDates().map(function(d) {
return d3.time.format("%Y-%m-%d").parse(d);
});
Modified jsfiddle here.