Create a function that brings me the days of the week from Monday to Sunday :
weekLabel(current) {
const week = [];
const weekFormat = [];
current.setDate(((current.getDate() - current.getDay()) + 1));
for (let i = 0; i < 7; i++) {
week.push(new Date(current));
current.setDate(current.getDate() + 1);
}
week.forEach((w) => {
weekFormat.push(moment(w).format('DD/MM/YYYY'));
});
return weekFormat;
},
In which current is what is waiting for the function that happens in this case a date ... this works correctly but when I pass a date on a Sunday and it returns me the days of the other week. I know that the week starts from Sunday but I would like to know if I can start from Monday