[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: BYDAY and YEARLY



On Monday, July 7 2003, "Dan Hickman" wrote to "kiwong, <ietf-calendar@xxxxxxx>" saying:

> 
> So your saying if BYMONTH is specified then the integer on BYDAY is now
> relative to a month instead of a year.  In my opinion, that is not at all
> clear from the RFC.  I'm curious if everyone else agrees with the following:
> 
> RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 as the last Sunday in October
> every year.
> 
> RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10,11,12 as the last Sunday in
> October, Nov, Dec every year.

I disagree.  This is the description of the intDAY grammar from RFC2445:

   Each BYDAY value can also be preceded by a positive (+n) or negative
   (-n) integer. If present, this indicates the nth occurrence of the
   specific day within the MONTHLY or YEARLY RRULE. For example, within
   a MONTHLY rule, +1MO (or simply 1MO) represents the first Monday
   within the month, whereas -1MO represents the last Monday of the
   month.

It's poorly worded, but clear when you read it; the integer applies to the
Nth occurence *within the interval*.  Also notice that in the grammar, ordwk
is defined as being in the range 1 to 53.

My code will resolve your two rules above as "no occurences other than
DTSTART" and "the last Sunday of the year" respectively, since the last
Sunday of the year always falls in December.

The rules with the descriptions you want are:
  RRULE:FREQ=MONTHLY;BYDAY=-1SU;BYMONTH=10
and
  RRULE:FREQ=MONTHLY;BYDAY=-1SU;BYMONTH=10,11,12

-- 
Jonathan Lennox
lennox at cs dot columbia dot edu