You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DateTime values are returned in local DateKind instead of Utc, when reading SharePoint List items data, even when DatesInUtc = true.
Tip
I did some investigation and it looks like the issue happens with this line when trying to parse the DateTime object from the JSON. DateTime.TryParse converts the date into local time per default. It looks like you can use this code to have the parsed DateTime be in UTC instead:
Load any date column from a view with DatesInUtc = true such as:
varoutput=awaitlist.LoadListDataAsStreamAsync(newRenderListDataOptions{ViewXml=viewXmlQuery,RenderOptions=RenderListDataOptionsFlags.ListData,DatesInUtc=true,});varitem=list.Items.AsRequested().First();vardate=item.Values["ConfirmedDate"];// here date.Kind == Local
Inspect that the returned DateTime object has Kind = Local
Expected behavior
When loading data with the argument is DatesInUtc = true I would expect to receive a UTC dates back and not Local dates.
Category
Describe the bug
DateTime values are returned in local DateKind instead of Utc, when reading SharePoint List items data, even when
DatesInUtc = true
.Tip
I did some investigation and it looks like the issue happens with this line when trying to parse the DateTime object from the JSON.
DateTime.TryParse
converts the date into local time per default. It looks like you can use this code to have the parsed DateTime be in UTC instead:Steps to reproduce
DatesInUtc = true
such as:Expected behavior
When loading data with the argument is
DatesInUtc = true
I would expect to receive a UTC dates back and not Local dates.Environment details (development & target environment)
The text was updated successfully, but these errors were encountered: