-Added JsonReader.ReadAsDateTimeOffset

-Fixed losing timezone information when deserializing DateTimeOffsets
This commit is contained in:
JamesNK
2010-09-12 03:39:39 +00:00
parent 11ce71ee8b
commit 235770442a
9 changed files with 245 additions and 30 deletions
@@ -928,10 +928,20 @@ namespace Newtonsoft.Json.Serialization
continue;
}
if (property.PropertyType == typeof(byte[]))
// don't read properties with converters as a specific value
// the value might be a string which will then get converted which will error if read as date for example
bool hasConverter = (GetConverter(GetContractSafe(property.PropertyType), property.Converter) != null);
if (property.PropertyType == typeof(byte[]) && !hasConverter)
{
reader.ReadAsBytes();
}
#if !NET20
else if (property.PropertyType == typeof(DateTimeOffset) && !hasConverter)
{
reader.ReadAsDateTimeOffset();
}
#endif
else
{
if (!reader.Read())