'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>,
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
