This is a migrated thread and some comments may be shown as answers.

[Solved] EXDATE in generated recurrence string is off by 4 hours

2 Answers 192 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kevin Schneider
Top achievements
Rank 1
Kevin Schneider asked on 05 May 2008, 09:04 PM
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.

2 Answers, 1 is accepted

Sort by
0
Kevin Schneider
Top achievements
Rank 1
answered on 06 May 2008, 01:06 PM
I probably should have mentioned - yes I realize this is a UTC issue.  What I don't understand is why the DTSTART/DTEND values are serialized using my local values but the exceptions are serialized as UTC values.

What happens is that if my start/end date for an appointment is 3:00pm and I make an exception and change some values then the exception date added would be 7:00pm.  When the calendar draws the dates it uses my 3:00pm local time for the appointment and since that is different from the 7:00pm exception it still shows the original occurence of the appointment along side the exception.
0
Accepted
T. Tsonev
Telerik team
answered on 07 May 2008, 01:40 PM
Hi Kevin,

Thank you for reporting this issue. We will try to fix it in time for the next service pack. Meanwhile, you can use the following workaround:

DateTime utcExceptionDate = DateTime.SpecifyKind(exceptionDate, DateTimeKind.Utc); 

Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Kevin Schneider
Top achievements
Rank 1
Answers by
Kevin Schneider
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or