Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#21 BYSETPOS in RRULE seems to be ignored

open
nobody
recur (12)
5
2004-05-26
2004-05-26
Dave Challis
No

Using one of rfc2445's examples (from page 43 of the rfc):
"the last work day of the month" could be represented as:
RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1

If I create a rule to do this using:
struct icalrecurrencetype recur =
icalrecurrencetype_from_string("FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1");
struct icaltimetype dtstart =
icaltime_from_string("20040527");
icalrecur_iterator* ritr =
icalrecur_iterator_new(recur, dtstart);

If I iterate through it, the next few occurences I get are:
20040527
20040528
20040531
20040601
20040602
20040603
20040604
20040607
20040608
20040609
20040610
20040611

This seems to be ignoring the BYSETPOS=-1, and just
generating occurences for each day, rather than the
last work day of the month.

If I use the same code as above, but instead use the
recurrence:
icalrecurrencetype_from_string("FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR");

then I get exactly the same sequence of occurences as
shown above, regardless of the fact that BYSETPOS isn't
present.

Dave

Discussion