2

our team has been researching a right way to represent reucurrences and we've stumbled upon RRule https://www.rfc-editor.org/rfc/rfc2445 (specified in the iCalendar rfc).

i'm trying to write an rrule in which it would allow me to generate dates that are 29 days away from the first day of every month. so it would look like this: jan29, mar1, mar29, apr29.

what's the correct RRule expression here? or is it even possible?

Community
  • 1
  • 1
  • thanks for the quick responses.... looks like this is really complex now. what i've thought of as the rule is something like "X amount of days from the first day of every month" that will apply to any month day – Ezekiel Fernandez Feb 05 '14 at 11:46

3 Answers3

1

You should be aware that RFC5545 superseeds RFC2445.

To go around the issue of leap years you should use RRULE and the BYYEARDAY and use the negative offsets.

So, first specify the 29th day of the year and then the 60th day (31 (for jan) + 29 (for after feb 1st)), then to go round the leap year you count from the back of the year:

  • knowing that Dec 31st offset in a BYYEARDAY list is: -1
  • then Dec 29th has an offset of: -3
  • similarly Nov 29th will have an offset of: -33

From which the RRULE property is written as follow:

RRULE:FREQ=YEARLY;BYYEARDAY=29,60,-278,...,-33,-3

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
Auberon Vacher
  • 4,655
  • 1
  • 24
  • 36
1

One option would be to craft your RRULE with an INTERVAL=29. Something like:

RRULE:FREQ=DAILY;INTERVAL=29

Not all iCalendar client support infinite repeating sets so you should include an UNTIL or COUNT component as well to suite your needs.

Bruce Kahn
  • 71
  • 2
0

No, invalid dates are discarded by RRULE. So even though you could do:

RRULE:FREQ=MONTHLY;BYMONTHDAY=29

it would just be skipped for every February (except leap years).

It is possible to specify multiple RRULE's for 1 event, but very little calendar software actually supports this.

Evert
  • 93,428
  • 18
  • 118
  • 189