You see, the title is self-referential in a totally hip, ironic, post-modern kind of way. Because I keep talking about ICalendar stuff. And because it's also about recurring events in ICalendar stuff. And ... oh, forget it.
So, we can parse hideously complicated recurring dates like the London.pm date scheme now. Which is cool.
However what happens when you want to have note - i.e you want to automatically say that the meetings are on the first Thursday after a Wednesday every month but then, on Thursday the 8th you want to say "It's in the Prince Arthur"?
Well, the secret, apparently is in the Recurrence-IDs and UIDs.
Look at this ICalendar snippet
BEGIN:VCALENDAR BEGIN:VEVENT DTSTART;TZID=Europe/London:20050815T110000 SUMMARY:Test event UID:2FB51E02-170F-11DA-B41B-000A9599EB44 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20050818T225959Z DURATION:PT1H END:VEVENT BEGIN:VEVENT DTSTART;TZID=Europe/London:20050816T110000 SUMMARY:This is on a Tuesday UID:2FB51E02-170F-11DA-B41B-000A9599EB44 RECURRENCE-ID;TZID=Europe/London:20050816T110000 DURATION:PT1H END:VEVENT END:VCALENDAR
Notice how the two UIDs are the same and that the RECURRENCE-ID of the second event is the exactly one day later than the DTSTART of the first one (which recurs daily)?
All we have to do is keep a list of all the events belonging to a UID then if we find an event with a RECURRENCE-ID look up all the events with its UID, check to see if the start time is the same and, if it is, replace it.