Search code examples
icalendarrfc5545

iCAL event on the last day of the Month


I need to create an event that falls on the last day of the month. If that day is a weekend I would like the event to show on the previous Friday. Thank you for any assistance you can provide.


Solution

  • Beyond the immediate answer, more generic solutions can be found by reading the RFC5545

    What you say is that you want an event that happens with a given recurrence which is detailed in the event recurrence rule, which defines the property RRULE for the components VEVENT as well as others (VALARM, VTODO) as well as the associated properties

    So:

    RRULE

    on a monthly basis

    RRULE:FREQ=MONTHLY;

    on a weekday:

    RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;

    only the last working day of the month

    RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1