Reputation:
I'm trying to create a iCal compliant recurrence rule which should reflect the pay days for people who get paid bi-monthly. The details for recurrence rules can be found on the RFC.
Here are the rules:
What I have so far:
[
"RRULE:FREQ=MONTHLY;BYMONTHDAY=15;BYDAY=MO,TU,WE,TH,FR", // this will select the 15th if it's not on a weekend
"RRULE:FREQ=MONTHLY;BYSETPOS=-1;BYDAY=MO,TU,WE,TH,FR;", // this correctly selects the last weekday of the month
]
The problem with this approach is if the 15th falls on a weekend, the event is omitted.
I'm not sure if this is something that can be modeled. Any help would be greatly appreciated.
Upvotes: 1
Views: 279
Reputation:
This discussion solved the problem.
For the 15th I needed the following rule:
RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=-1;BYMONTHDAY=13,14,15;BYDAY=MO,TU,WE,TH,FR
So thats the last weekday before the 15. I had to add the 13,14,15 since those are esentially the only possible dates that I can occur. (Worst case would be that the 15th is Sunday, so the preceding Friday would be the 13th
The two rules together got me what I needed!
Upvotes: 1