I make a call to a web service, which returns an item, one property of which is:
"startDate":"/Date(1398859200000+1100)/"
In my C# representation, I have:
public class MyClass
{
public DateTimeOffset StartDate {get; set;}
}
In my unit test, I have the following assertion
var expectation =
new DateTimeOffset(2014, 04, 30, 12, 0, 0, new TimeSpan(0, 11, 0, 0));
Assert.That(specialOfferContent.End, Is.EqualTo(expectiation).Within(1).Seconds);
(not sure if there's a better way to assert this...)
If deserialize this from JSON using (without specifying DateParseHandling), the result I get is:
Expected: 04/30/2014 12:00:00 +11:00 +/- 00:00:01
But was: 04/30/2014 13:00:00 +01:00
Alternatively, if I specify DateParseHandling as DateParseHandling.DateTimeOffset
I get this:
Expected: 04/30/2014 12:00:00 +11:00 +/- 00:00:01
But was: 04/30/2014 23:00:00 +11:00
My question is, what am i doing wrong?
It is ignoring the +1100 part of the date when I do