0

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"

Dmitry Mishin
  • 37
  • 1
  • 7

2 Answers2

1

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.

anmari
  • 3,830
  • 1
  • 15
  • 15
  • Checking this one: `FREQ=MINUTES;INTERVAL=30;BYDAY=2MO,2WE` here https://jakubroztocil.github.io/rrule/ produces the following toText: "every 30 years on the 2nd Monday and 2nd Wednesday", so it doesn't seem right. – dubbha Jul 08 '19 at 09:22
  • It has a bug - treating Typo as YEARLY, should be MINUTELY not MINUTES, so RRULE:FREQ=MINUTELY;INTERVAL=15;BYDAY=2MO,2WE – anmari Jul 09 '19 at 06:12
  • anmari, with your permission I am fixing the typo and upvoting your answer. – dubbha Aug 01 '19 at 16:24
0

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.

dubbha
  • 81
  • 4