pls check this my problem is similar to this How to manage date using momentjs for a monthly payments?
The result what I want in Monthly is like this if the given date is 01-25-2022
and the terms is 3
Result
02-25-2022
03-25-2022
04-25-2022
semi-monthly if the given date is 04-29-2022
and the terms is 3
Result
05-14-2022
05-29-2022
06-14-2022
<!--FOR MONTHLY -->
var dateRelease = new Date("01-25-2022")
const terms = 3
for (let i = 0; i < terms; i++) {
console.log(new Date(dateRelease.setDate(dateRelease.getDate() + 31)).toISOString().slice(0, 10))
}
<!--FOR SEMI-MONTHLY -->
var dateRelease = new Date("04-29-2022")
const terms = 3
for (let i = 0; i < terms; i++) {
console.log(new Date(dateRelease.setDate(dateRelease.getDate() + 15)).toISOString().slice(0, 10))
}