We encountered an issue with occurrence generation of iCalendar patterns using SETPOS=-1
Test 1:
RecurrencePattern(“DTSTART:20160118T100000\r\nRRULE:FREQ = MONTHLY; BYDAY = MO,TU,WE,TH,FR; BYHOUR = 12; BYMINUTE = 0; BYSETPOS = -1”);
var dates = pattern.GenerateOccurrences(new DateTime(2016, 1, 19, 9, 0, 0), new DateTime(2016, 2, 19, 9, 0, 0));
Assert(dates.Count == 1); // Fails - 2 dates are generated. One at the correct instance of 1/29/16 @ 12 PM but also one at 1/19/16 @ 12 PM
Test 2:
RecurrencePattern(“DTSTART:20150119T100000\r\nRRULE:FREQ = MONTHLY; BYDAY = MO,TU,WE,TH,FR; BYSETPOS = -1”);
var dates = pattern.GenerateOccurrences(new DateTime(2016, 1, 19, 9, 0, 0), new DateTime(2016, 2, 19, 9, 0, 0));
Assert(dates.Count == 1); // Fails - 2 dates are generated. One at the correct instance of 1/29/16 @ 12 PM but also one at 1/19/16 @ 9 AM
Testing with SETPOS=1 also fails in the same way.
Note that “DTSTART:20160119T100000\r\nRRULE:FREQ = MONTHLY; BYDAY = MO,TU,WE,TH,FR; BYHOUR = 5; BYMINUTE = 0; BYSETPOS = -1” works. It seems that if the time component of DTSTART is after the time component of the pattern.
This was tested with 6.0 and 6.1 versions of Aspose.Email