| if (calendarEvent.RecurrenceParent != null && calendarEvent.ExceptionDate.HasValue) |
| { |
| DateTime exceptionDate = calendarEvent.ExceptionDate.Value; |
| RecurrenceRule rrule; |
| if (RecurrenceRule.TryParse(calendarEvent.RecurrenceParent.RecurrencePattern, out rrule)) |
| { |
| if (!rrule.Exceptions.Contains(exceptionDate)) |
| { |
| rrule.Exceptions.Add(exceptionDate); // Add the exception date to the parent rule |
| calendarEvent.RecurrenceParent.RecurrencePattern = rrule.ToString(); |
| } |
| } |
| } |
I'm having an issue when trying to manually add datetime values to a recurrences exception list. Above you can see the code I'm using.
My problem is that when I use rrule.ToString() the date that is being generated for EXDATE in the resulting string is ahead by 4 hours. The rest of the dates (DTSTART, DTEND, UNTIL) are all correct though.
Thanks for your help.