Dmitry Mishin
Dmitry Mishin

Reputation: 47

iCalendar recurrence rule for event to run: every two weeks, on Mondays and Wednesdays, each 30 minutes within a day of event?

I need to schedule an event in a form of iCalendar (RFC5545) rrule. The event should be fired: every two weeks, on Mondays and Wednesdays, every 30 minutes within a day of event.

So far I created this rrule string: FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE;BYHOUR=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23;BYMINUTE=30

I expect the event to run "every two weeks, on Mondays and Wednesdays, every 30 mins within a day".

But it actually means to run: "every two weeks, on Mondays and Wednesdays, on every 30th minute within a day"

Upvotes: 0

Views: 2236

Answers (2)

dubbha
dubbha

Reputation: 81

I believe you can just add another minute within an hour to BYMINUTE as you would normally do in a crontab:

FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE;BYHOUR=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23;BYMINUTE=0,30

This currently produces the following rule.all() at https://jakubroztocil.github.io/rrule/ :

Wed,    10  Jul 2019    00:00:53    GMT
Wed,    10  Jul 2019    00:30:53    GMT
Wed,    10  Jul 2019    01:00:53    GMT
Wed,    10  Jul 2019    01:30:53    GMT
...
Wed,    10  Jul 2019    23:00:53    GMT
Wed,    10  Jul 2019    23:30:53    GMT
Mon,    15  Jul 2019    00:00:53    GMT
Mon,    15  Jul 2019    00:30:53    GMT
...
Mon,    15  Jul 2019    23:00:53    GMT
Mon,    15  Jul 2019    23:30:53    GMT
Wed,    17  Jul 2019    00:00:53    GMT
Wed,    17  Jul 2019    00:30:53    GMT
Wed,    17  Jul 2019    01:00:53    GMT

which I believe is what you want.

Upvotes: 0

anmari
anmari

Reputation: 4173

Dmitry, Below is a possible solution, however you should note that some applications (google?) do not accept recurring minutes which is what I believe your question results in.

You have to think about the RRULE modifiers as doing one of two things: 1 expanding and 2 limiting. So for example: Your repeating event is actually repeating every 30 minutes.

See example for "Every 15 minutes for 6 occurrences" and "Every 20th Monday of the year" on https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html.

So your example would be FREQ=MINUTES;INTERVAL=30 'expanding', but then also you want to 'limit' it to only on every 2nd monday and wednesday, so adding a BYDAY:

FREQ=MINUTES;INTERVAL=30;BYDAY=2MO,2WE

This cheatsheet https://icalevents.com/2447-need-to-know-the-possible-combinations-for-repeating-dates-an-ical-cheatsheet/ may help to see valid combinations that give expansion or that limit the recurring bits.

Upvotes: 1

Related Questions