In my application, a server with a time zone of UTC + 05: 30 works . My client machine has a time zone of UTC-05: 00 .
Now suppose he enters 12/31/1989 into a text box and saves the form, when he views the details in a kendo grid, the date is displayed as 12/30/1989 instead of 12/31/1989 .
I debugged the application by changing the time zone of my computer and in debugging I found that
- Date does not change until insert / update is started. He stays 12/31/1989 .
- The database date is also stored as 12/31/1989 .
- When I get data from the database, the model and controller date are still 12/31/1989 .
- But when I return the data to the kendo grid in JSON format using the following query, it shows the date on the page as 12/30/1989 .
WITH#
public ActionResult GetPatients([DataSourceRequest] DataSourceRequest request, int includePatientId = 0)
{
return Json(this.patienModel.RetrieveActivePatients().ToDataSourceResult(request));
}
Kendo grid
@(Html.Kendo().Grid<RxConnectEntities.Patient>
().Name("PatientList")
.Columns(columns =>
{
columns.Bound(p => p.PatientID).Visible(false);
columns.Bound(p => p.Name).Width(100);
columns.Bound(p => p.Gender).Width(80);
columns.Bound(p => p.DateOfBirth).Width(90)
.Format("{0:MM/dd/yyyy}")
.EditorTemplateName("DateOfBirth")
.Filterable(false).HtmlAttributes(new { id = "gridDateOfBirth" })
.ClientTemplate("#: kendo.toString(kendo.parseDate(data.DateOfBirth),'MM/dd/yyyy') #");
columns.Bound(p => p.PhoneNumber).Title("Phone Number").Width(110);
columns.Command(command =>
{
command.Custom("Select").Click("OnSelectRow");
command.Custom("Edit").Text("Edit").Click("EditGrid");
}).Width(120);
})
.Pageable(p => p.PageSizes(true))
.DataSource(dataSource => dataSource
.Ajax().ServerOperation(true)
.PageSize(5)
.Model(m => m.Id(p => p.PatientID))
.Read(read => read.Action("GetActivePatientList", "Order")
.Data(@"function(){
return{
includePatientId:" + (TempData["includePatientId"] ?? 0) + @"
}
}"))
.Destroy(delete => delete.Action("Deletepatient", "Order"))
)
)
source
share