For instance, I have start
and end
start = new Date(2013, 2, 28)
end = new Date(2013, 3, 2)
How could I get from this an array like this
[new Date(2013, 2, 28),
new Date(2013, 2, 29),
new Date(2013, 2, 30),
new Date(2013, 2, 31),
new Date(2013, 3, 1),
new Date(2013, 3, 2)]
I'm currently reading docs about Time-Scales but still having trouble in understanding how to use them for achieving this effect. (Or, maybe there is a better way to do this, if so, I'd be happy to know)
To update this answer for the d3 V4 syntax, use:
var dateRange = d3.timeDays(new Date(2013, 2, 28), new Date(2013, 3, 2));
Some important notes:
Just found out that I can use range
with Time Intervals
d3.time.day.range(new Date(2013, 2, 28),
new Date(2013, 3, 2 + 1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With