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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

146911 Aug 25,2019 05:42 PM UTC Oct 23,2019 08:56 AM UTC Blazor 9
loading
Tags: Scheduler
Matthew
Asked On August 25, 2019 05:42 PM UTC

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


Matthew
Replied On August 30, 2019 12:48 PM UTC

Anyone had a chance to look at this yet?

Thanks

Uwe Hein
Replied On 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

Uwe Hein
Replied On 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

Nevitha Ravi [Syncfusion]
Replied On 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 


Matthew
Replied On 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

Nevitha Ravi [Syncfusion]
Replied On 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. 


Fergus
Replied On 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.

Nevitha Ravi [Syncfusion]
Replied On 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 


Nevitha Ravi [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon