问题
I've seen How can an ICS file be written for a recurring event? but I've got a rather complex recurrence and can't figure out a rule after looking at the syntax of RRULEs.
I want an event that happens on the Friday preceding the first Saturday of each month. This Friday-before-the-first-Saturday may of course be in the previous month. I assume that if I can get this to work, similar (but not identical) events for Friday-before-the-second-Saturday, and -third- and -fourth-, with Friday before 5th Saturdays undefined.
Obviously I'd have RRULE:FREQ=MONTHLY;BYDAY=FR;
but if I try to follow some of the examples using BYMONTHDAY
I run into trouble: 28
would be a valid Friday-before-a-first-Saturday in February, but in any other month, Friday 28th would be the Friday before a 5th Saturday. Similarly for 29
(in a leap year), 30
and 31
.
The goal is to include this in a Google Calendar, which I know supports display of ICS RRULEs it can't edit. So, assuming it's possible, how can I create an RRULE for this event? I've considered a separate event and accompanying rule for each month length. 31: Jan, Mar, May, Jul, Aug, Oct, Dec and 30: Apr, Jun, Sep, Nov are OK, but leap years are still an issue: 28 Feb could be a Friday before a first Saturday or a 5th Saturday (e.g. 2020 so one of my first two cases fails).
回答1:
You're on the right track with having to use BYDAY=FR, AND since you can do negative BYMONTHDAY, the following should do the trick:
RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=-1,1,2,3,4,5,6
来源:https://stackoverflow.com/questions/52592891/how-can-i-write-an-ics-file-for-the-friday-before-the-first-saturday-of-the-mont