I am having a problem with a date property being deserialised incorrectly from a JSON API. The date is being returned from the API as UTC to the ISO8601 format e.g.
2013-01-085T13:15:30Z. RestSharp is deserialising the object and the date is being populated incorrectly the kind value is returned as 'unspecified' even though the date string has the 'Z' to indicate it is UTC.
After looking at RestSharp sourcecode, it appears the deserialization is calling the DateTime.ParseExact() or DateTime.TryParseExact() methods depending on whether a dateformat has been specified. Neither of these method calls specify a DateTimeStyle
and as such the original date format is not being preserved. Looking at the msdn documentation it appears that the only DateTimeStyle which would preserve the original datetime kind is the RoundtripStyle.
http://msdn.microsoft.com/en-us/library/91hfhz89.aspx
I have created a series of tests to demonstrate this problem, and they are attached.
Am I correct in saying the DateTimeStyle.RoundTripKind needs to be specified, and the alterations to the date formats in the TryParseExact calls would be the correct solution?
If so would this be a change that would considered for the standard deserializers?
Thanks,
David