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

Kendo UI grid Date Time UTC & DatePicker

4 Answers 798 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aleksandr
Top achievements
Rank 1
Bronze
Iron
Veteran
Aleksandr asked on 26 Jul 2018, 08:39 AM

Hello,

we ran into the issue when grid automatically convert datetime to local one, but in popup for explme we have a form with standard  DateTime picker which does not do that, as a result of it we have diff dates in grid & in the popup when we edit the grid row. 

are there any solution we can use to make it consistent? The preferable will be DateTime picker behavior when date is displayed as it is 

 

Thx Alex

 

 

4 Answers, 1 is accepted

Sort by
0
Aleksandr
Top achievements
Rank 1
Bronze
Iron
Veteran
answered on 29 Jul 2018, 11:27 AM
solution was found, but it is so wired that Telerik could not implement it, i read a lot of post where it was explained that it will affect existing clients, but ...... just leave this behavior as default and let us ability by setting some property have the dates in UTC. 
0
Viktor Tachev
Telerik team
answered on 30 Jul 2018, 07:39 AM
Hello Alex,

By default when a date is returned from the server the browser will apply an offset to it corresponding to the current client-side time zone. In order to use the same time zone on the server and client I would suggest the approach illustrated in the following article.

https://docs.telerik.com/aspnet-mvc/helpers/grid/how-to/editing/utc-time-on-both-server-and-client

It uses the DataSource requestEnd event to remove the applied offset so the same date and time is shown on the client and server. 

Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Adrian Segovia
Top achievements
Rank 1
answered on 15 Jul 2020, 08:46 PM

Hello, I've use this solution before. However I just started to have problems again.

it looks like this piece is no longer valid: prop.indexOf("/Date(") == 0)
The date does not come with it and it does not apply the offset.

Could you help?
Thanks 
Adrian

0
Tsvetomir
Telerik team
answered on 17 Jul 2020, 02:32 PM

Hi Adrian,

In case the ASP.NET MVC wrappers are used for serving the data, then you should set the following option of the DataSource:

.StringifyDates(true)

 

Regards,
Tsvetomir
Progress Telerik

Tags
Grid
Asked by
Aleksandr
Top achievements
Rank 1
Bronze
Iron
Veteran
Answers by
Aleksandr
Top achievements
Rank 1
Bronze
Iron
Veteran
Viktor Tachev
Telerik team
Adrian Segovia
Top achievements
Rank 1
Tsvetomir
Telerik team
Share this question
or