0

Hi dear stackoverflow community people, need your help in a problem.

I am using rrule JavaScript lib to generate event dates for calendar. Below is the example condition for which I want event dates.

freq: Monthly startDate: 1 Nov 22, 6AM count: 10 weekdays: Mon, Tuesday, and Friday

now what other inputs/parameter should I give to rrule so that it generates dates only for 3rd week of the month? (Basically, I want event to occur in every specified week (first, second, third, fourth, last) of every month in the give date range or number of counts).

please tell me if and how is it possible through rrule only or if this can be achieved using any other way or other lib along with rrule.

Thank you in advance. Please ask if have any question or need clarity.

Initially, I tried bysetpos but then realise that it gives nth number of the day I selected (for example bysetpos:1 and byweekday: Mon will give every first monday of the month)

Dheeraj
  • 28
  • 8

1 Answers1

0

I don't think this is possible using iCalendar RRULE property which is what rrule.js library is based around.

AFAIK the closest you can get is this.

{
  freq: RRule.MONTHLY,
  interval: 1,
  byweekday: [RRule.MO.nth(4), RRule.TU.nth(4), RRule.FR.nth(4)]
}

which will give you Xth (4th in this case) weekday in the month. But they are not guaranteed to be in the same week. I may be wrong and I'd be happy to be corrected.