Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1175
igGrid UTC Dates not working
posted

I've read all of the articles for UTC dates for the newer versions but they aren't working.

MVC v4.17.2.183

Here's what I got:

    @(Html.Infragistics().Grid<TaskModel>()
          .PrimaryKey("TaskApprovalId")
          .ID("GlobalTasksGrid")
          .AutoGenerateColumns(false)
          .AutoGenerateLayouts(false)
          .EnableUTCDates(true)
          .Columns(column =>
          {
              column.For(m => m.TaskApprovalId).DataType("number").HeaderText(" ").Hidden(true);
              column.For(m => m.Location).DataType("string").Width("215").HeaderText("Location");
              column.For(m => m.Task).DataType("string").Width("195").HeaderText("Task").Template("[Task Name]");
              column.For(m => m.Employee).DataType("string").Width("155").HeaderText("Employee").Template("[Employee Name]");
              column.For(m => m.ApprovalDate).DataType("date").Format("dateTime").Width("180").HeaderText("Date")
                    .Template("<div align='center'>${ApprovalDate}</div>").DateDisplayType(DateDisplayType.Local);
          })
          .Features(feature =>
          {
             feature.Updating()
                    .EnableAddRow(false)
                    .EnableDeleteRow(true)
                    .EditMode(GridEditMode.None);
          })
          .AutoCommit(true)
          .DataSourceUrl(Url.Action("GetGlobalTasks"))
          .DataBind()
          .Render()
     )

EnableUTCDates set to true.  This notifies the datasource that the incoming date are in UTC format.  So it should convert it into a Date object.

LocalSchemaTransform is set to true by default, which is what we want.

The ApprovalDate column is set to DateTime and the DateDisplayType is set to "local".

Unfortunately, the desired result is still the same.  The UTC date stored in the database is still rendered as such to the client.

Here's the data coming from the server:

The only thing that stands out is the Metadata.timezoneOffset which I don't set myself.

Thoughts?