function generateRandomTime() { const hours = Math.floor(Math.random() * 11); // Random hours between 0 and 10 const minutes = Math.floor(Math.random() * 60); // Random minutes between 0 and 59 return `${hours} h ${minutes} m`; } function generateDateObjects(startDate, endDate) { const dateObjects = []; const currentDate = new Date(startDate); while (currentDate <= endDate) { const timeWorked = generateRandomTime(); dateObjects.push({ time_worked: timeWorked, date: new Date(currentDate) }); currentDate.setDate(currentDate.getDate() + 1); // Move to next day } return dateObjects; } // Example usage: const startDate = new Date(2024, 2, 10); // March 10, 2024 const endDate = new Date(2024, 2, 24); // March 24, 2024 const dateObjectsArray = generateDateObjects(startDate, endDate); console.log(dateObjectsArray);