Fix invalid cast with DateTimeOffset
This occurred when using DateParseHandling.DateTimeOffset
This commit is contained in:
@@ -136,7 +136,7 @@ namespace Newtonsoft.Json.Converters
|
|||||||
{
|
{
|
||||||
#if !NET20
|
#if !NET20
|
||||||
if (t == typeof(DateTimeOffset))
|
if (t == typeof(DateTimeOffset))
|
||||||
return new DateTimeOffset((DateTime)reader.Value);
|
return reader.Value is DateTimeOffset ? reader.Value : new DateTimeOffset((DateTime)reader.Value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return reader.Value;
|
return reader.Value;
|
||||||
|
|||||||
Reference in New Issue
Block a user