3

I have an recurring event on the 7th of each month but am struggling to find an RRule that I can put into a text editor and import into google calendar. I need the rule to put the event on the last week day if the 7th falls on a weekend. Thanks in advance.

David
  • 31
  • 2

2 Answers2

0

Due to the fallback condition, I don't think you can achieve this only defining a RRULE, unfortunately.

RRULE in Google Calendar follows RFC 5545 specification.

With RFC 5545, regarding monthly recurrences, you can either set the recurring rule for a specific day of the month (e.g. always on the 7th of the month would be RRULE:FREQ=MONTHLY;BYMONTHDAY=7) or a specific offset of day of the week within a month (e.g. second to last weekday of the month would be RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2).

Only using this specification, I don't believe there is a way to select the previous (or next) weekday in reference to the 7th day of the month.

However you can always achieve this by using a script to generate the dates or interpret an existing list you already have before insert them on Google Calendar.

Gustavo
  • 639
  • 2
  • 4
  • Thanks for pointing me in the right direction. Using your BYSETPOS argument I changed it to +5 and also my starting date to 5th August 2022 and hey presto I now have monthly calendar reminders on either the 7th of each month if a week day or 5th, 6th if my deadline falls on a Saturday/Sunday. Thanks – David Aug 03 '22 at 13:45
  • 1
    @David, care to show how the RRULE ended up being? – joeloui Nov 01 '22 at 14:00
0

Though I'm quite late, maybe someone else is interested in it too:

RRULE:FREQ=MONTHLY;WKST=MO;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1;BYMONTHDAY=5,6,7

Will pick every 5th, 6th and 7th of the month (BYMONTHDAY), only if they fall on a weekday (BYDAY). Of those resulting 1-3 days a month all but the last one are dumped (BYSETPOS).

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77