var getFutureDate = (breakDate) => { let arr = new Array(breakDate); for(let i=0;i<arr.length;i++){ let thisTime = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * i); let fullYear=thisTime.getFullYear(); let month=(thisTime.getMonth() + 1); let date=thisTime.getDate(); arr[i]=`${fullYear}-${month}-${date}` } return arr } console.log(getFutureDate(7)); // 0: "2022-9-29" // 1: "2022-9-30" // 2: "2022-10-1" // 3: "2022-10-2" // 4: "2022-10-3" // 5: "2022-10-4" // 6: "2022-10-5"