I have a Kendo UI MVC grid on a page. In this grid are three date columns. The dates (no time value) are stored in the database as local time (not UTC). These columns are defined in the grid as follows:
columns.Bound(p => p.CloseoutDate).ClientTemplate("#= moment(CloseoutDate).format('MM/DD/YYYY') #").Width(120);
columns.Bound(p => p.BeginDate).Title("Begin Date").ClientTemplate("#= moment(BeginDate).format('MM/DD/YYYY') #").Width(110);
columns.Bound(p => p.EndDate).Title("End Date").ClientTemplate("#= moment(EndDate).format('MM/DD/YYYY') #").Width(110);
You can see I'm using moment.js to do my date formatting. However, it seems that moment is assuming these dates are UTC dates and converting them to local time. When the grid is displayed, the dates look as follows:
All these dates are off by one day. For example, the first row should be 1/15/2010, 1/1/2010, 1/15/2010. Is this normal moment behavior, and can it be changed?
Also, CloseoutDate, BeginDate and EndDate are actual C# datetime values. In the SQL Server database they are stored as dates.