We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Problem with Daylight Saving/TimeZone when using a DataSource with Scheduler

I have a bit of an odd problem with the scheduler, when using a datasource for the events, and when creating or editing an event when in daylight saving period (for me in the UK end of March to end of October) then the scheduler behaves strangely. It does initially put the events in the right slots in the scheduler, but if I edit or create a new event, or try to move an event, after trying this, everything moves back an hour.
I have tested with your example of data bound examples from https://ej2.syncfusion.com/blazor/documentation/schedule/getting-started/ but I changed the dates so that they were in a daylight saving range as below
<EjsSchedule TValue="AppointmentData" Height="650px" SelectedDate="new DateTime(2018, 5, 14)">
    <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>
</EjsSchedule>

@code{
    List<AppointmentData> DataSource = new List<AppointmentData>
    {
        new AppointmentData { Id = 1, Subject = "Paris", StartTime = new DateTime(2018, 5, 13, 10, 0, 0) , EndTime = new DateTime(2018, 5, 13, 12, 0, 0) },
        new AppointmentData { Id = 2, Subject = "Germany", StartTime = new DateTime(2018, 5, 15, 10, 0, 0) , EndTime = new DateTime(2018, 5, 15, 12, 0, 0) }
    };
    public class AppointmentData
    {
        public int Id { get; set; }
        public string Subject { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
    }
}

Running this, I get the following:


All perfectly fine

If I edit the Germany event to change it's name, this happens

1. Edit the title


2. Click Save and this:


It's as if the scheduler has taken the time and tried to process the timezone offset (in this case GMT +1 for British summer time) and saved the event back one hour earlier.

If there is no datasource specified, everything works OK.

One more thing, when using a template to display the events, the time shows as one hour earlier that the slot it is in, so it looks as if timezone offset processing is happening more than once - anyway, something is not right with it.

I am using Client-side Blazor if that affects anything. To replicate the problem above you will need to be working where the date is in a daylight saving period. Everything seems to work fine when out side of that range (e.g. for me the scheduler works for dates outside British summer time)

Thanks


9 Replies

MA Matthew August 30, 2019 12:48 PM UTC

Anyone had a chance to look at this yet?

Thanks


UH Uwe Hein August 30, 2019 06:35 PM UTC

Matthew,

  have to to some more testing to confirm this, but it seems you are right. I am from Germany.

    regards

       Uwe


UH Uwe Hein September 1, 2019 01:28 PM UTC

Matthew,

  tried with the demo app - upgraded to 47 beta. The same result. Every save changes the starting time to -1 hour. I am using Win 10 Pro (german) Version 1809. 

Serverside seems to work without problems.

    regards

       Uwe


NR Nevitha Ravi Syncfusion Team September 3, 2019 12:23 PM UTC

Hi Mathew/Uwe, 

By default, in Blazor client side application the timezone will be considered as UTC instead of system/client timezone which is the cause for the reported problem and for the same please refer the following link. 

Currently we are checking the workaround possibilities to overcome the issue at our end, we will get back to you with further details on September 5, 2019 and would appreciate your patience until then.  

Regards, 
Nevitha 



MA Matthew September 3, 2019 06:03 PM UTC

Thanks to Uwe for also looking into this, and to Nevitha for the confirmation of the issue. I understand that perhaps server-side blazor is more of a priority at the moment as that is due for full release in the next month or so. I'm thinking it may be safer for me to swtich to using server side for my project and perhaps wait for .net 5 before using client-side. Anyway, I look forward to an update on the problem later this week.

Cheers


NR Nevitha Ravi Syncfusion Team September 5, 2019 01:23 PM UTC

Hi Mathew, 

Thanks for being patience. 

We planned to fix the issue “client-side application not considering system timezone” in our source which can be tracked from the following link and the fix will be included in our Volume 3 SP1, 2019 release.  

We would appreciate your patience until then. 

Regards, 
Nevitha. 



FE Fergus September 6, 2019 08:00 AM UTC

Hi,
Just to note i am using server side Blazor and i am experiencing the same error. Using Sql Server. Everything looks ok after creating an event. But when you navigate away and back again it has changed to an hour earlier.


NR Nevitha Ravi Syncfusion Team September 9, 2019 02:01 PM UTC

Hi Fergus, 

Thanks for your update. 

We suspect that you have updated the database with start and end time of the appointments that received from the arguments of ActionCompleted event. It returns the appointment data with UTC timezone.  So, please convert them to local timezone using the following code to overcome the reported problem. 

    public void OnActionCompleted(ActionEventArgs<AppointmentData> args) 
    { 
        if (args.RequestType == "eventCreated") 
        { 
            args.AddedRecords.ForEach(app => 
            { 
                var newEvent = new AppointmentData(); 
                newEvent.StartTime = app.StartTime.ToLocalTime(); 
                newEvent.EndTime = app.EndTime.ToLocalTime(); 
                newEvent.Subject = app.Subject; 
                newEvent.Description = app.Description; 
                newEvent.Id = app.Id; 
                db.CalendarEvents.Add(newEvent); 
            }); 
            db.SaveChanges(); 
        } 
        … 
    } 

Please try the above solution and confirm whether your reported issue is resolved. Or share your timezone details with CRUD actions code snippet to serve you better if the issue persist still. 

Regards, 
Nevitha 



NR Nevitha Ravi Syncfusion Team October 23, 2019 08:56 AM UTC

Hi All, 

The reported issue with timezone in Blazor client-side application has been resolved and included in our latest release v17.3.0.19-beta. Now the appointments will render on system timezone on CRUD actions and also time received in templates are in system timezone instead of UTC. Kindly ensure the fix in latest version and get back to us for further assistance. 

Regards, 
Nevitha 


Loader.
Live Chat Icon For mobile
Up arrow icon