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

Create datetime without time zone information

1 Answer 444 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 16 Jul 2014, 01:06 PM
Hi, I´m having some trouble editing dates in a grid. In the schema model, the type is "date". If i set the date to 02/07/2014 (using the calendar that pops up automatically) in the model the object it´s transformed into: Date {Wed Jul 02 2014 00:00:00 GMT+0200}. Then, when sending this object back to the server for saving the row, the value sent is 2014-07-01T22:00:00.000Z, which is the json representation for that date, i guess (JSON.stringify and kendo.stringify subtract those 2 hours from the date), so the value stored in the database is wrong.
I need to know what is the correct way to manage this. Best solution for me would be that the framework somehow created those dateTime objects without specifying +2 GMT.
Thanks.


1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 18 Jul 2014, 07:44 AM
Hello Juan Jose,

This is a well known scenario caused by the fact that Date objects in JavaScript are always created with a timezone offset taken from the operating system's clock. I would recommend checking this example, which illustrates how the case could be handled by converting the dates to UTC time both on the client and the server side.

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
Fernando
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or