Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
How to make Monthly, semi-monthly date payment using js

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))

}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Moment.js is made for this job.

<!--FOR MONTHLY -->

var dateRelease = moment("2022-01-25")

const terms = 3
for (let i = 0; i < terms; i++) {
  console.log(dateRelease.add(1, 'months').format('YYYY-MM-DD'))

}
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.3/moment.min.js"></script>

<!--FOR SEMI-MONTHLY -->


var dateRelease = moment("2022-04-29")

const terms = 3
for (let i = 0; i < terms; i++) {
  console.log(dateRelease.add(2, 'weeks').format('YYYY-MM-DD'))

}
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.3/moment.min.js"></script>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!