How to have an iCalendar (RFC 2445) repeat YEARLY with duration

Posted by Todd Brooks on Stack Overflow See other posts from Stack Overflow or by Todd Brooks
Published on 2009-07-09T22:21:32Z Indexed on 2010/04/22 22:03 UTC
Read the original article Hit count: 250

Filed under:

I have been unsuccessful in formulating a RRULE that would allow an event as shown below:

Repeats YEARLY, from first Sunday of April to last day of May, occuring on Monday, Wednesday and Friday, until forever.

FREQ=YEARLY;BYMONTH=4;BYDAY=SU (gives me the first Sunday of April repeating yearly)

and

FREQ=YEARLY;BYMONTH=5;BYMONTHDAY=-1 (gives me the last day of May repeating yearly)

But I can't figure out how to have the event repeat yearly between those dates for Monday, Wednesday and Friday.

Suggestions?

Update: Comments don't have enough space to respond to Chris' answer, so I am editing the question with further information.

Unfortunately, no. I don't know if it is the DDay.iCal library I'm using, or what, but that doesn't work either. I've found that the date start can't be an ordinal date (first Sunday, etc.)..it has to be a specific date, which makes it difficult for my requirements. Even using multiple RRULE's it doesn't seem to work:

BEGIN:VCALENDAR 
VERSION:2.0 
PRODID:-//DDay.iCal//NONSGML ddaysoftware.com//EN 
BEGIN:VEVENT 
CREATED:20090717T033307Z 
DTSTAMP:20090717T033307Z 
DTSTART:20090101T000000 
RRULE:FREQ=YEARLY;WKST=SU;BYDAY=MO,WE,FR;BYMONTH=4,5 
RRULE:FREQ=YEARLY;WKST=SU;BYDAY=1SU;BYMONTH=4 
RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=5;BYMONTHDAY=-1 
SEQUENCE:0 
UID:352ed9d4-04d0-4f06-a094-fab7165e5c74 
END:VEVENT 
END:VCALENDAR

That looks right on the face (I'm even starting the event on 1/1/2009), but when I start testing whether certain days are valid, I get incorrect results.

For example,

4/1/2009 12:00:00 AM = True   // Should be False
4/6/2009 12:00:00 AM = True  
4/7/2009 12:00:00 AM = False
4/8/2009 12:00:00 AM = True
5/1/2009 12:00:00 AM = True
5/2/2009 12:00:00 AM = False
5/29/2009 12:00:00 AM = True
5/31/2009 12:00:00 AM = True  // Should be False
6/1/2009 12:00:00 AM = False

I'm using Douglas Day's DDay.iCal software, but I don't think it is a bug in that library. I think this might be a limitation in iCalendar (RFC 2445).

Thoughts?

© Stack Overflow or respective owner

Related posts about icalendar