In the Aspose.iCalendar API Reference the following line can be read for the RecurrencePattern.StartDate Property:
"The start date of the recurrence pattern always counts as the first
occurrences, unless it is excluded in ExDates."
This causes some trouble for me, because I would expect the following behavior:
If today is Friday and I specify a RecurrencePattern with start date today, to reoccur 3 times every 1 week on Friday, the start date is my first occurrence.
If today is Tuesday and I specify a RecurrencePattern with start
date today, to reoccur 3 times every 1 week on Friday, next Friday
is my first occurrence.
So sometimes the first occurrence should be the start date, but other times the first occurrence should be second occurrence. Besides that, in the latter case 1 occurrence too little is calculated.
Does anyone now a solution to handle this situation with Aspose.iCalendar?
This “feature” of the iCalendar standard also puzzles us at Aspose. So far we have not found an elegant solution for this. I’m too looking forward to hearing suggestions on this issue.
The problem right now is that one doesn’t know if the start date fits in the recurrence pattern.
I could make a wrapper method for the calculate method to work around the issue:
Start calculating from StartDate - 1 with EndDate.Count = 2
If the second occurrence is my StartDate, then StartDate fits in the recurrence pattern, otherwise it is not.
If the start date fits in the recurrence pattern, just calculate the occurrences.
If the start date does not fit in the recurrence pattern, specify ExDates = StartDate and calculate the occurences.
If the iCalendar standard isn’t clear about this issue, Aspose could support both options in the iCalendar component. For example, a boolean parameter could be added to the calculate method indicating wheter the start date should be the first occurrence in the calculated series or not in case the start date does not fit in the recurrence pattern. Internally the iCalendar could follow the same approach as my wrapper method.
My wrapper method is still not working as I would expect. In case the start date does not fit in the recurrence pattern and the option EndDate.Count is used for the end date, EndDate.Count - 1 occurences are calculated.
This would mean ExDates are counted as ocurrences. Is this by design?
For now I can work around the second issue by increasing the count by 1 before starting the calculation.
Just wanted to follow up on this thread to see if there was any progress on this issue. Looks like it has been a year since it has been addressed. I have the same requirement that the start date must only be included in the occurence dates if it falls within the pattern.
For example
1. If you wanted every friday of the year, and your start date was 1/5/2007 (a friday), it would be included
2. If you wanted every friday of the year, and your start date was 1/1/2007 (which is a monday), it should not include 1/1/2007 in the occurences.
If you play with the outlook recurrence module it seems to handle these situations correctly. I would expect similiar functionality.
Just wondering if there where any updates to this issue in the module itself, or if anyone has any other workarounds... other than including start date in the exculsion list because it may fall under the pattern.
I’d like to add my name to the unofficial “I’d like to see this implemented” list. While I understand that there are two sides to this issue, I’m of the opinion that the calling application shouldn’t have to write logic to figure out when the first occurrence should be, no matter how easy it may be to do so.