Schedule the Every Nth Weekday Monthly Event Using RFC 5545 Repeat Rule

I am trying to replicate some scheduling features in a Google Calendar in C # using the RFC5545 repeat rule.

There are two options for monthly planning of the Google calendar: every month on the Nth day, i.e. Every 10th day of the month, every 1 month , this will obviously happen regardless of the day of the week.

My repeat rule for this is: FREQ=MONTHLY;BYMONTHDAY=10

Another option is to repeat the event on every Nth day of the week, that is: " Every second Sunday every month , this is the one with which it is difficult for me to write a rule for.

What should be my rule for the second rule? I tried FREQ=MONTHLY;BYDAY=SU , but I'm not sure how / which parameters to use to instruct only to do this every 2nd Sunday of the month.

I use the DDay iCal C # library to generate my repeat rule, but I'm glad it will show what the rule string should look like to achieve the desired behavior.

I use the RFC 5545 return rule.

+5
source share
1 answer

You are almost there. You need to set the index per day, RFC5545 says:

Each BYDAY value may also be preceded by a positive (+ n) or negative (-n) integer. If present, this indicates the nth occurrence of a particular day during the MONTHLY or ANNUAL "RRULE".

for which RFC5545 later gives an example

Monthly on the first Friday for 10 cases:

  DTSTART;TZID=America/New_York:19970905T090000 RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR 

so for you this rule should be:

RRULE:FREQ=MONTHLY;BYDAY=2SU

+3
source

Source: https://habr.com/ru/post/1203445/


All Articles