find date range btween start date to end date in node js
const startDate = new Date('2023-01-01'); // Replace with your start date
const endDate = new Date('2023-12-31'); // Replace with your end date
const dateRange = getDateRange(startDate, endDate);
console.log(dateRange);
function getDateRange(start, end) {
const dateArray = [];
let currentDate = new Date(start);
while (currentDate <= end) {
dateArray.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}
return dateArray;
}