Any way to ignore weekend days?


#1

In addition to a prior post about weekdays only, I would like to create a pattern like “Every 3rd weekday of January 2004”. I want weekend days completely ignored, not just excluded from the occurrence dates. For example, I would consider Wed. to be 3 weekdays after Friday, but if you just count every third day that’s not a weekend, Monday is. The dates I would like to see are 1/1/2004, 1/6/2004, 1/9/2004, 1/14/2004, 1/19/2004, 1/22/2004, 1/27/2004 and 1/30/2004. However, using:

DTSTART:20040101T000000
RRULE:FREQ=DAILY;UNTIL=20040201T000000Z;INTERVAL=3;BYDAY=MO,TU,WE,TH,FR

I get 1/1/2004, 1/7/2004, 1/13/2004, 1/16/2004, 1/19/2004, 1/22/2004 and 1/28/2004. Is there any way to represent the pattern I want? I’m really not even sure it’s possible with the full iCalendar specification, but I would appreciate any help on this.


#2

Good pattern.

The issue here is that according to the iCalendar standard INTERVAL rule part is processed before any BYXXX rule parts are processed.

This results in “take every 3rd day, then take only MO,TU,WE,TH,FR from the result set”.

Obviously this is not “take MO, TU, WE, TH, FR and then take every third from the result” that will achieve the desired result.

So far we have not found a way to do what you want in iCalendar, but we will try a few more ideas. Hard to belive that iCalendar does not support such seemingly simple pattern.

We tried using BYSETPOS=3,6,9…, but BYSETPOS (according to the standard) works within each interval so it will not work for your DAILY well.


#3

It’s not a pressing issue, as our customer wants “Outlook-style recurrence” which doesn’t include any weekday patterns other than “Every weekday”, which of course, works just fine. Also, “every other weekday” will work using the pattern above with INTERVAL of 2 on the fact that a weekend contains two days. The pattern still considers weekend days, but the result is the same. This seems like a useful enough pattern, though, so I’d still like to know if there is a way to represent it. Thanks.


#4

We’ve found the pattern that will work for this, but you need to use latest Aspose.iCalendar 1.0.2 for this to work.

DTSTART;TZID=US-Eastern:20040101000000
RRULE:FREQ=MONTHLY;UNTIL=20040201000000Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1,4,7,10,13,16,19,22,25,28,31

I must admit the pattern is quite complex and not sure if it will be helpful to you.