I am trying to write a function that grabs the first 14 days (starting today) with momentJS. My function currently looks like
let dateArr = Array(14).fill(moment())
.map((date) => {
return date.add(1, 'days')
});
I understand that fill
is for static values and not dynamic ones, so how would I go about fixing this up so that I have an array that has, ['11/12', '11/13', '11/14', etc...]
I think i need some sort of recursion so that it adds 1 day from the last iteratee, or else i think it'll just keep adding 1 day from today for each iteration