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

94
Views
Moment Js recur every nth month on first Sunday

I'm trying to generate recurrence for every 2 months on the first Sunday

I have tried this code so far but not getting the expected output

How Do I chain for every nth Month?

let c = moment('05-01-2022', 'MM-DD-YYYY').recur().every(1).daysOfWeek()
                                                  .every(0).weeksOfMonthByDay()

console.log(c.next(5))

// output Console:
[
  Moment<2022-05-02T18:30:00Z>,
  Moment<2022-06-06T18:30:00Z>,
  Moment<2022-07-04T18:30:00Z>,
  Moment<2022-08-01T18:30:00Z>,
  Moment<2022-09-05T18:30:00Z>
] 

Expected Output

[
  Moment<2022-05-02T18:30:00Z>,
  Moment<2022-07-04T18:30:00Z>,
  Moment<2022-09-05T18:30:00Z>,
  Moment<2022-11-07T18:30:00Z>,
  Moment<2023-01-02T18:30:00Z>,
] 
about 4 years ago · Juan Pablo Isaza
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!