I'm reading through RFC 5545 and trying to determine how to correctly find a set of occurrences. Let's say I have a WEEKLY rrule = 2 (every other week). I also have specified a BYDAY rule part for Tue, Wed, Thu. Let's assume my start date is 2011-04-07 (Thu) and my end date is 2011-04-27 (Wed). Obviously ignoring less significant than date, I would think my occurrence set would contain: 2011-04-07, 2011-04-12, 2011-04-13, 2011-04-21, 2011-04-26, 2011-04-27.
What is throwing me off is this statement from the RFC: "The WKST rule part specifies the day on which the workweek starts. Valid values are MO, TU, WE, TH, FR, SA, and SU. This is significant when a WEEKLY "RRULE" has an interval greater than 1, and a BYDAY rule part is specified."
So, if my WKST=MO, I'm seeing an implication from the above statement that the week does not start from the start date, but from the WKST. Which means that instead of using a week based off of the start date, in this case, Thu-Wed, I need to actually start with WKST and determine which occurrences fall within THAT week (Mon-Sun) and every other week from THAT WKST. So, for calculation purposes, my starting date would actually be 2011-04-04. That falls before the start date so I jump ahead TO the start date but I stick with a Mon-Sun week. Which means my occurrence set is actually: 2011-04-07, 2011-04-19, 2011-04-20, 2011-04-21. That is vastly different than my original set.
Additionally, IF this is the proper way to calculate, does that also mean in expanding rrule situations for other frequencies with >1 intervals I must "start" at the beginning of that period instead of the start date. Does MONTHLY encompass the 1st - last day of the month of the start date. Does YEARLY encompass Jan 1 - Dec 31 of the year of the start date?
I hope there's an iCalendar guru out there...I can't wrap my head around the logic here. Thanks.
UPDATE: I did create a few .ics files and import into google calendar. Assuming google is interpreting these correctly, I can confirm that having an expanding MONTHLY with INTERVAL>1 will use the 1st to last day of the month, NOT a month starting from the start date from the event. YEARLY rules work in the same manner, the year goes from Jan 1st-Dec 31st. Not what I originally expected but hopefully this can help someone else out.