I’m willing to create a recurring date based on "nth weekday of month" Here is my solution work when I select current Date
let dates = {};
const currentDate = dayjs();
const recurrence = currentDate
.recur(dayjs().add(4, "month"))
.every("Wednesday")
.daysOfWeek()
.every(currentDate.monthWeekByDay())
.weeksOfMonthByDay();
recurrence.all().forEach((date) => {
dates[date.format("YYYY-MM-DD")] = { selected: true, };
});
// dates = ["2022-09-21","2022-10-19","2022-11-16","2022-12-21","2023-01-18"]
but if put last day of this month which is 30
let dates = {};
const lastDayofMonth = dayjs().endOf("month");
const recurrence = lastDayofMonth
.recur(dayjs().add(4, "month"))
.every("Friday")
.daysOfWeek()
.every(lastDayofMonth.monthWeekByDay())
.weeksOfMonthByDay();
I was expecting to get
["2022-09-30","2022-10-28","2022-11-25","2022-12-30"..]
instead of
["2022-09-30","2022-12-30"]
Here is demo
Am I missing something ? Thanks in advance