This is a migrated thread and some comments may be shown as answers.

[Solved] DateTime and daylight savings

1 Answer 320 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 12 Mar 2015, 07:28 PM
Using Kendo version 2014.2.1008

MVC grid with AJAX binding.

My grid displays dates using .Format("{0:MM/dd/yyyy}") and the fields are DateTime in the model with 00:00:00 as the time component.  I had to set a default value to ensure that Kendo sees them as dates, but it works for most users.

Then there's Indiana, where not every part of the state uses daylight savings time.  Those that do not use daylight savings, see those dates as one day prior.  How do I stop this or how do I see exactly what's going on with the translation of these dates?  When they are passed to the view using .ToDataSourceResult, it has the correct dates.

1 Answer, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 12 Mar 2015, 08:11 PM
It's more than just daylight savings.  That one causes some strange dates, but not all of them (JavaScript math fail?).  For those that have this issue, it's really all timezones that give problems due to .NET and browsers.

http://www.telerik.com/support/code-library/using-utc-time-on-both-client-and-server-sides
Tags
Grid
Asked by
James
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Share this question
or