This is a migrated thread and some comments may be shown as answers.
timezone always utc
2 Answers 248 Views
This is a migrated thread and some comments may be shown as answers.
Entilzha
Top achievements
Rank 2
Entilzha asked on 11 Feb 2014, 06:40 PM
I am using the scheduler with ASP.NET MVC.  I set the timezone value to "Est/UTC" yet the start and end DateTime values are always using "Utc" as the "Kind".  I have also tried by NOT setting the timezone value.  I have been looking through these posts for the past couple of hours and found nothing that works.  I want the DateTime values that get passed back through the controller to tell me the correct local time for that user or the correct "adjusted" value in UTC.  To repeat, I am getting the correct local time but reported as UTC.  That means a 5pm event gets saved as a noon event for someone in EST.

Is there some setting I am missing?  This seems like it should be obvious but I am stuck.

in controller.cs
public ActionResult Schedule()
{
    var now = DateTime.Now;
    ViewBag.StartTime = new DateTime(now.Year, now.Month, now.Day, 7, 0, 0, DateTimeKind.Local);
    ViewBag.TimeZone = "Etc/UTC";
    return View();
}


in view.cshtml
@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()
    .Name("scheduler")
    .Date(DateTime.Now)
    .StartTime((DateTime)ViewBag.StartTime)
    .Timezone((string)ViewBag.TimeZone)
    .AllDaySlot(false)
    .Editable(e =>
    {
        e.Create(true);
        e.Destroy(true);
        e.Update(true);
    })
    .Height(590)
    .Views(views =>
    {
        views.DayView();
        views.WeekView(v => v.Selected(true));
        views.MonthView();
        views.AgendaView();
    })
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.TaskID);
            m.Field(f => f.TaskID);
            m.Field(f => f.Title);
            m.Field(f => f.ProviderId);
            m.Field(f => f.Start);
            m.Field(f => f.StartTimezone);
            m.Field(f => f.EndTimezone);
            m.Field(f => f.Description);
            m.Field(f => f.RecurrenceID);
            m.Field(f => f.RecurrenceRule);
            m.Field(f => f.RecurrenceException);
            m.Field(f => f.OwnerID);
            m.Field(f => f.IsAllDay);
        })
        .Read(read => read.Action("Read", "Scheduler").Data("additionalData"))
        .Create(create => create.Action("Create", "Scheduler").Data("additionalData"))
        .Update(update => update.Action("Update", "Scheduler"))
        .Destroy(destroy => destroy.Action("Destroy", "Scheduler"))
        .ServerOperation(true)
    )
)

2 Answers, 1 is accepted

Sort by
0
Entilzha
Top achievements
Rank 2
answered on 12 Feb 2014, 02:19 AM
I found my answer(s).  There were two problems as I see it.  The first is the recommendation is to be very careful how you specify the timezone.  The list of IANA time zones is miserable and I really hope Telerik upgrades to the "GMT-05:00" style instead.

The other problem was I had not included "kendo.timezones.min.js" in the page so the scheduler was never going to know what the timezone was no matter what I told it.

I love it when I can figure out my own problems!
0
Entilzha
Top achievements
Rank 2
answered on 15 Feb 2014, 07:50 PM
Apparently you can't mark your own responses as the answer.  Still, there is an answer to the question and this topic is closed if someone else could mark it that way.
Asked by
Entilzha
Top achievements
Rank 2
Answers by
Entilzha
Top achievements
Rank 2
Share this question
or