Let's say I have an event that occurs at 7:00 and 2:00pm each day. The RRule would look like this:
FREQ=DAILY;BYHOUR=10,14
If I wanted an event that occurs at 10:00am and 2:30pm, I would assume it would look like this:
FREQ=DAILY;BYHOUR=10,14;BYMINUTE=0,30
But this doesn't seem to be correct. The spec says that "BYxxx rule parts for a period of time less than the frequency generally increase or expand the number of occurrences of the recurrence". Testing this at http://jkbrzt.github.io/rrule/ produces the following:
What I really want is this:
I figured out I could make this work using BYSETPOS
:
FREQ=DAILY;BYHOUR=10,14;BYMINUTE=0,30;BYSETPOS=1,4
If you wanted 10:30am and 2:00pm, you'd use:
FREQ=DAILY;BYHOUR=10,14;BYMINUTE=30,0;BYSETPOS=2,3
The recurrence instances will be in chronological order, so, the order of BYMINUTE
has no effect on BYSETPOS
. To demonstrate, if we remove BYSETPOS
, both of the above rules will yield the following instances for each day:
╔═══╦══════╦════════╗ ║ P ║ Hour ║ Minute ║ ╠═══╬══════╬════════╣ ║ 1 ║ 10 ║ 00 ║ ║ 2 ║ 10 ║ 30 ║ ║ 3 ║ 14 ║ 00 ║ ║ 4 ║ 14 ║ 30 ║ ╚═══╩══════╩════════╝
So in the first case, we're selecting instances 1 and 4, and in the following case we're selecting instances 2 and 3.
Note that this only works if DTSTART
uses the first BYHOUR
/BYMINUTE
values (10:00am in the above cases).