Is it timezone error in scheduler?

6 posts, 1 answers
  1. Grzegorz
    Grzegorz avatar
    3 posts
    Member since:
    Mar 2011

    Posted 02 Oct 2013 Link to this post

    i have kendo scheduler configured as follows:
    @(Html.Kendo().Scheduler<Dansinn.Models.Event>()
        .Name("scheduler")
        .Height(600)
        .Messages(messages =>
        {
            messages.Save(LocalizationResources.OK);
            messages.Cancel(LocalizationResources.Cancel);
        })
        .Views(views =>
        {
            views.DayView();
            views.WeekView(weekView => weekView.Selected(true));
            views.MonthView();
            views.AgendaView();
        })
        .Timezone("Etc/UTC")
        .Editable(editable => editable.TemplateName("Event").Resize(false))
        .DataSource(builder =>
        {
            builder.Events(events =>
            {
                events.Error("bs.kendo.scheduler.onError");
                events.RequestEnd("bs.kendo.onRequestEnd");
            });
            builder.Create(operationBuilder => operationBuilder.Action<ScheduleController>(controller => controller.Create(null)));
            builder.Update(operationBuilder => operationBuilder.Action<ScheduleController>(controller => controller.Update(null)));
            builder.Destroy(operationBuilder => operationBuilder.Action<ScheduleController>(controller => controller.Remove(null)));
            builder.Read(operationBuilder => operationBuilder.Action<ScheduleController>(controller => controller.Get(null)));
            builder.Model(factory =>
            {
                factory.Id(model => model.Id);
                factory.Field(model => model.Type);
                factory.Field(model => model.Start);
                factory.Field(model => model.End);
                factory.Field(model => model.Title);
                factory.Field(model => model.RecurrenceRule);
                factory.Field(model => model.RecurrenceException);
                factory.Field(model => model.Description);
                factory.Field(model => model.IsAllDay);
            });
        }))
    In my computer I have currently timezone UTC+2. When I adding a new event and set start date to 17:10 (5:10 PM) it is send to server as 19:10 (7:10 PM). I think that scheduler should send to server 15:10 value (3:10 PM). Is it bug in scheduler or in my understanding?
  2. Grzegorz
    Grzegorz avatar
    3 posts
    Member since:
    Mar 2011

    Posted 03 Oct 2013 Link to this post

    I have a second question also. I found out that scheduler always gets and displays events in regard to the client system timezone.
    The timezone property of the scheduler indicates in which timezone are stored events on server (am I correct?). There is no property to set client timezone.
    Is there a way to specify client timezone and override the default behavior?

    Example scenario:
    There is a store in Australia that is open from 8 to 16. "Opening hours" is an event in scheduler.
    Manager of the store is on a business trip to US (he changed timezone to US timezone).
    Now when he wants to change the store opening hours he must consider the diferent timezone offset.
    In our application we want to set fixed timezone on the client, based on the manager's store, which is in Australia.

    Our desired behavior would be to have an option to set client timezone. If it isn't set, it could get it from the client system (trough javascript).
    Is this possible in current implementation?
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 03 Oct 2013 Link to this post

    Hi,

     
    I would suggest to download the latest internal build (you can open a new support ticket and ask for it) of KendoUI Scheduler where the dates are send to the server with the correct format allowing correct binding on the server side.

    Also when the Scheduler timeZone is set to "UTC" (using the "Timezone" method) then the events should be displayed in the specified timeZone (I would suggest to check this functionality after upgrading to the latest internal build).

    KInd Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Grzegorz
    Grzegorz avatar
    3 posts
    Member since:
    Mar 2011

    Posted 03 Oct 2013 Link to this post

    The version we're using is v2013.2.918.
    Scheduler is sending events in UTC (it is autoconverting from local client timezone) (after setting it trough the TimeZone property). OK
    Server is sending dates in UTC also (UTC stored in database). OK
    Scheduler after receiving event converts them to the client timezone. OK

    Two problems we're experiencing:
    1. We want to set client timezone. We don't want the scheduler to get the client timezone (probably by javascript).
    2. We think that the timezone conversion is wrong. It doesn't show up, when events are added trough scheduler, but it shows up when events are added externally (directly to database). I attached a diagram with explanation of the problem.

    Please provide feedback for the 2 points mentioned here. Thank you.


  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 07 Oct 2013 Link to this post

    Hi Grzegorz,

     
    I'm little confused to the last answer as I already mention that the issue you are referring to is already fixed in the latest internal builds (after your current version of KendoUI). I would suggest to download and install the latest internal build (you can get it by requesting it in a new support ticket) and open a new forum post or support thread if you have additional questions. 

    Kind Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Answer
    Grzegorz
    Grzegorz avatar
    3 posts
    Member since:
    Mar 2011

    Posted 10 Oct 2013 Link to this post

    Hello,

    First of all thank you for your help.
    We did as you advised and got our hands on the latest internal build.
    We found out that scheduler changed datetime format to ISO and started to convert times properly =].
    We found also that we had a bug, because our dates read from database had DateTime.Kind set always to unspecified and this resulted in bad serialization to json: "2013-10-02T17:25:47" (should be "Z" at the end to specify the UTC zone).
    Now we are always setting the DateTime.Kind to UTC and everything works just fine; scheduler gets date as UTC: "2013-10-02T17:25:47Z"

    Thank you once again, now everything works as expected.

    EDIT: To treat and serialize datetimes from db as UTC you can set (Global.asax in MVC project) GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
Back to Top
UI for ASP.NET MVC is VS 2017 Ready