Treegrid DatePicker column stores dates in UTC and shows to user differente date

I'm using a treegrid where one of the columns is a DatePicker.

The users' browser is in the "Europe/Lisbon" timeZone. (but could be any other, depending on the users' browser)
The server is running with a different timeZone, in this case just for testing purposes the server is in the "(UTC+14) Kiritmati Island". (could be other one)

When the user selects the date 05/06/2020 (with a date format in DD-MM-YYYY), in the server I get 04-06-2020 23h00 with DateTime.Kind=UTC and that is stored in the SQL Server. I know that the DatePicker sends to the server the selected date in UTC.

When the browser refresh, the date that is shown to the user is 04/06/2020. (why ?? shouldn't the date be ok according to users timeZone ?)
I know that this is an issue timeZone related, I've tried the following threads and others:


but I can't make it work.

The goal would be to use the date (only) provided by the user store it in the DB, and then show it again, with no conversion being made, because in this case the only thing that is important is the date selected by the user ignoring the time portion.

What is I'm missing? 
thanks.

1 Reply

KR Karthikeyan Raja Syncfusion Team March 11, 2020 05:09 PM UTC

Hi ShareValue, 
 
We have analyzed and validated your reported query. As you said, the reported issue is due to time zone differs. We overcome the reported issue on load time by using DateTimeKind.Utc with date object values. So we suggested you to follow the same to resolve this. By converting date object values to UTC which is send from client to server and do the same for server to DB you can overcome the issue. 
If the problem still persists at your end. kindly revert us with your client to server code or sample so that will be more helpful to serve you better. 
 
Regards, 
Karthikeyan Raja 


Loader.
Up arrow icon