I wrote this for loop:
// I expect to get the day of 10/12/2019
const startDate = parseInt(new Date('10/12/2019').getDate());
// I expect to get the day of 22/12/2019
const endDate = parseInt(new Date('22/12/2019').getDate());
// Creating an empty array to push data later on
let freedays = [];
// for loop where i equals the day of the startdate: '10', and where the condition is that
let i has to be smaller of equal to endDate: '22' for the loop to stop.
for (let i = startDate; i <= endDate; i++) {
freedays.push(i)
}
console.log(freedays)
I always get an empty array when executing this function, whereas I want to get the days in between startDate and EndDate.
Could anyone help me understand what I'm doing wrong?