I have a start date and an end date, and I want to generate a list of dates between (and including) these two dates. But I don\'t get why it isn\'t working...
function dateList(dateStart, dateEnd) {
var dates = [];
for (i = dateStart; i <= dateEnd; i.setDate(i.getDate() + 1)){
dates.push(new Date(i));
}
return dates;
}
console.log(dateList(new Date('2017-05-08'), new Date('2017-05-12')));