I ran through a lot of RRULEs just for testing out the performance of google-rfc-2445 (a Java implementation of IETF RFC 2445 iCalendar).
I saw that I got the start date back in some cases in the returning list from the method.
The test is very simple:
private static void runGoogleTests() throws ParseException
{
DateTimeZone dtz = DateTimeZone.UTC;
DateTime dtStart = new DateTime("2014-11-22T00:00:00Z", dtz);//SATURDAY
DateTimeIterable dti = DateTimeIteratorFactory.createDateTimeIterable("RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO", dtStart, dtz, true);
System.out.println("Size of iterable = " + Iterators.size(dti.iterator()));
for(DateTime dateTime : dti)
{
System.out.println(dateTime);
}
}
The list returned by the factory returns this list.
The first date is the start date and it's a saturday that should not be there. The RRULE also contained a COUNT=10 so why return 11?
Size of iterable = 11
2014-11-22T00:00:00.000Z
2014-11-24T00:00:00.000Z
2014-12-01T00:00:00.000Z
2014-12-08T00:00:00.000Z
2014-12-15T00:00:00.000Z
2014-12-22T00:00:00.000Z
2014-12-29T00:00:00.000Z
2015-01-05T00:00:00.000Z
2015-01-12T00:00:00.000Z
2015-01-19T00:00:00.000Z
2015-01-26T00:00:00.000Z
Someone using the Google-rfc-2445 must have encountered this problem before?
I posted the issue on the projects page but it's very quiet there. Link to the issue on google-rfc-2445 page
Try something like this:
The idea is to start the sequence one day earlier and to exclude the first date by using EXDATE rule.