Fix invalid cast with DateTimeOffset

This occurred when using DateParseHandling.DateTimeOffset
This commit is contained in:
Matt Johnson
2014-04-05 20:16:53 -04:00
parent b04b594c38
commit bb1cd89f09
@@ -136,7 +136,7 @@ namespace Newtonsoft.Json.Converters
{
#if !NET20
if (t == typeof(DateTimeOffset))
return new DateTimeOffset((DateTime)reader.Value);
return reader.Value is DateTimeOffset ? reader.Value : new DateTimeOffset((DateTime)reader.Value);
#endif
return reader.Value;