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

Date value inside Grid getting reduced by a day depending on the Client Machine's Time Zone

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ketan
Top achievements
Rank 1
Ketan asked on 14 Jan 2014, 09:15 AM


Steps to reproduce the issue:

1. Open the Telerik asp.net mvc grid page shown in the below link.

http://demos.telerik.com/aspnet-mvc/razor/Grid/EditingAjax?theme=vista

2. Click on Add New Record button and enter a date in one of the date pickers in the grid. Click on save button.

3. Now change the TimeZone of your machine to a TimeZone which is running at least a few hours behind your current Time Zone and refresh the entire page (Ctrl+F5).

4. If there is a major time difference between the newly selected timezone and your default timezone then the previously saved date would get reduced by a day. For example: if the date you had saved was 1/1/2014 it would get changed to 12/31/2013.

5. Could you please help understand why this is happening and provide a solution that would prevent the date being reduced by a day depending on the client machine's time zone.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 15 Jan 2014, 03:57 PM
Hello Ketan,

This happens because the Date objects in JavaScript  are always created with a timezone offset according to the operating system's clock. I would suggest checking this KendoUI project, which demonstrates how to use UTC time on both client and server.

On a side note I would like to remind you that as of June 2013, Telerik Extensions for ASP.NET MVC has reached its official End of Life, with no additional fixes or enhancements expected in the future. I would strongly recommend migrating to KendoUI for ASP.NET MVC as we no longer provide support for the Telerik Extensions.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Ketan
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or