I have a period of 6 days between 2 iso strings:
const period = {
start: "2020-07-19T22:00:00.000Z",
end: "2020-07-25T22:00:00.000Z"
}
I'd like to have the 6 different days of the week included into this period like
[
'monday',
'tuesday',
'wednesday',
etc
]
So far this is what I came up with:
const days = [];
for (let i = 0; i < 6; i++) {
const day = moment(this.period.start).add(i, 'days');
days.push(moment(day).day());
}
Is there a simple/elegant way to do this with moment.js?