Parsing RRule results wrong occurrences for this specific case

75 Views Asked by At

Last instance of daily & monthly recurring not fetching properly, while same case works fine for weekly recurring. I have saved the recurring pattern of events in DB, but when I fetch from DB and set events properties and called event.GetOccurrences(). I have events for 1,2,3,4 Aug but when rule is parsed(i.e after calling event.GetOccurrences()) it gives 4 instances with 1st aug repeated twice so we have occurrence for 1,1,2,3 Aug with 4 Aug got missed.

For Daily recurring meeting 
FREQ=DAILY;COUNT=4;BYHOUR=13;BYMINUTE=30;BYSECOND=0

The above pattern gives instances as 1 Aug,1 Aug, 2 Aug, 3 Aug, gives 4 instances but 4 Aug missed and 1 Aug repeated twice, after this I set time in these instances.

For Weekly recurring meeting 
FREQ=WEEKLY;COUNT=4

When above pattern is parsed by same function then it gives 4 instances of correct date, after that I set time for these occurrences from DB.

1

There are 1 best solutions below

0
On

I have done a workaround. I have reset BY Hour, Minute and Second.

RecurrencePattern recurringPattern = new RecurrencePattern(recurringRule);
if (recurringPattern.Count > 0)
{
    recurringPattern.ByHour = new List<int>();
    recurringPattern.ByMinute = new List<int>();
    recurringPattern.BySecond = new List<int>();
}
calendarEvent.RecurrenceRules.Add(recurringPattern);