I am using iCal4J and have a situation where users will
want things to happen every weekday. There are two ways
to cause this to happen, and the user may choose either
one of them, depending on which they feel is more
intuitive:
1. Specify weekly frequency with an interval of 1,
and use a by day rule of MO,TU,WE,TH,FR
2. Specify daily frequency with an interval of 1, and
use a by day rule of MO,TU,WE,TH,FR
According to the spec, the first will multiply the
recurrences, the second will filter them.
With the ical4j library, the first example works, the
second does not. It just returns an empty list.
It appears that the problem lies in the
getAbsWeekDays() function. It has a section for
handling weekly, monthly, and yearly frequencies, but
nothing for daily.
Logged In: YES
user_id=249465
This patch addresses the bug by adding some code to
Recur.java. It also has a test case in VEventTest.java to
identify the bug. Apply the patch just to VEventTest.java
and things will fail. Apply the patch to Recur.java and they
will work again.
Since I was in that code anyway, I've also added a test for
Monthly recurrences with a BYDAY rule, just to prove it
works. And I updated the existing test to check its exact
return values.
Patch with test case demonstrating bug and a fix for it
Logged In: YES
user_id=14058
Hi Bruce,
I've finally applied this patch. I actually started to look
at the problem, forgetting you provided this patch, but then
came up with the same solution anyway. :)
I've added another test in RecurTest.testGetDatesByDay(), to
test this also. Note that a rule like this:
FREQ=DAILY;INTERVAL=1;COUNT=10;BYDAY=MO,TU,WE,TH,FR
will actually return less than 10 valid dates, as the day
filtering is performed after the interval/count processing.
I'm not sure if this is correct functionality, but I think
it will do for now.
regards,
ben