function dateRange(startDate, endDate, steps = 1) {
const dateArray = [];
let currentDate = new Date(startDate);
while (currentDate <= new Date(endDate)) {
dateArray.push(new Date(currentDate));
currentDate.setUTCDate(currentDate.getUTCDate() + steps);
}
return dateArray;
}
I need to add a class for each element of the array so that I can change the background color of those dates that are in that range between start and end date. I tried through e.target, but it does not work because it's an array of dates.