RRULE Processing A particular BYxxx rule part may expand or limit the set of date/times generated by the rule. The expand or limit behaviour is governed by the FREQ value used for the rule. Example: RRULE:FREQ=MONTHLY;BYMONTH=1,3,5;BYDAY=MO,TU The FREQ=MONTHLY value would match each of the twelve months in a year. The BYMONTH=1,3,5 rule part limits the matching months to just the 1st, 3rd and 5th in a year. The BYDAY=MO,TU rule part adds each Monday and Tuesday within the matching months to the recurrence set. The table below shows the dependency of BYxxx rule part expand or limit behaviour on the FREQ value in the rule. When evaluating a rule, each BYxxx rule part must be evaluated in the order it appears in the table (i.e. BYMONTH evaluated before BYWEEKNO), irrespective of the expand or limit behaviour. BYDAY has some special behaviour depending on the FREQ value and this is described in separate notes below the table. +--------------------------------------------------------------------------+ | |SECONDLY|MINUTELY| HOURLY | DAILY | WEEKLY | MONTHLY | YEARLY | |----------+--------+--------+--------+--------+--------+---------+--------| |BYMONTH | Limit | Limit | Limit | Limit | Limit | Limit | Expand | |----------+--------+--------+--------+--------+--------+---------+--------| |BYWEEKNO | Limit | Limit | Limit | Limit | Limit | N/A | Expand | |----------+--------+--------+--------+--------+--------+---------+--------| |BYYEARDAY | N/A | N/A | N/A | N/A | N/A | N/A | Expand | |----------+--------+--------+--------+--------+--------+---------+--------| |BYMONTHDAY| Limit | Limit | Limit | Limit | N/A | Expand | Expand | |----------+--------+--------+--------+--------+--------+---------+--------| |BYDAY | Limit | Limit | Limit | Limit | Note 1 | Note 2 | Note 3 | |----------+--------+--------+--------+--------+--------+---------+--------| |BYHOUR | Limit | Limit | Limit | Expand | Expand | Expand | Expand | |----------+--------+--------+--------+--------+--------+---------+--------| |BYMINUTE | Limit | Limit | Expand | Expand | Expand | Expand | Expand | |----------+--------+--------+--------+--------+--------+---------+--------| |BYSECOND | Limit | Expand | Expand | Expand | Expand | Expand | Expand | |----------+--------+--------+--------+--------+--------+---------+--------| |BYSETPOS | Limit | Limit | Limit | Limit | Limit | Limit | Limit | +----------+--------+--------+--------+--------+--------+---------+--------+ +--------------------------------------------------------------------+ | Note 1 | Special expand for WEEKLY. | | | | | | A BYDAY rule part cannot have a numeric value in a | | | FREQ=WEEKLY rule (i.e. 'MO', 'TU' etc is allowed, but | | | '1MO', '2TU' is not allowed). | | | | +--------+-----------------------------------------------------------| | Note 2 | Limit if BYYEARDAY or BYMONTHDAY is present, | | | otherwise special expand for MONTHLY. | | | | | | The numeric value in a BYDAY rule part in a FREQ=MONTHLY | | | rule corresponds to an offset with the month. | | | | +--------+-----------------------------------------------------------| | Note 3 | Limit if BYYEARDAY or BYMONTHDAY is present, | | | otherwise special expand for WEEKLY if BYWEEKNO present, | | | otherwise special expand for MONTHLY if BYMONTH present, | | | otherwise special expand for YEARLY. | | | | | | A BYDAY rule part cannot have a numeric value in a | | | FREQ=YEARLY rule (i.e. 'MO', 'TU' etc is allowed, but | | | '1MO', '2TU' is not allowed), if BYWEEKNO is specified. | | | | | | The numeric value in a BYDAY rule part in a FREQ=YEARLY | | | rule with a BYMONTH present corresponds to an offset with | | | the month. | | | | | | The numeric value in a BYDAY rule part in a FREQ=YEARLY | | | rule without BYWEEKNO or BYMONTH present corresponds to | | | an offset within the year. | | | | +--------+-----------------------------------------------------------+