We are having such a nasty problem when deserializating a JSON date to a C# DateTime.
The code is:
JavaScriptSerializer serializer = new JavaScriptSerializer();
jsonTrechos = jsonTrechos.Replace("/Date(", "\\/Date(").Replace(")/", ")\\/");
Trecho[] model = serializer.Deserialize<Trecho[]>(jsonTrechos);
The jsonTrechos
is a string of json2.js's JSON.stringify();
.
Problem is: the deserialization works, bur all dates of the Trechos objects are added with 2 hours.
My timezone is Brazil (UTC -3) and we're under daylight savings (so we're currently on UTC -2), if it has anything to do. I guess that perhaps localization and timezones may be playing a part on this and if they really are, I have no idea on how to fix it.