Merge branch 'master' of https://github.com/wojtpl2/Newtonsoft.Json into wojtpl2-master
This commit is contained in:
@@ -1674,7 +1674,7 @@ namespace Newtonsoft.Json.Converters
|
||||
#if !PORTABLE
|
||||
return XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind));
|
||||
#else
|
||||
return XmlConvert.ToString(d);
|
||||
return XmlConvert.ToString(d, DateTimeUtils.ToDateTimeFormat(d.Kind));
|
||||
#endif
|
||||
}
|
||||
else if (reader.TokenType == JsonToken.Null)
|
||||
|
||||
@@ -73,6 +73,21 @@ namespace Newtonsoft.Json.Utilities
|
||||
throw MiscellaneousUtils.CreateArgumentOutOfRangeException("kind", kind, "Unexpected DateTimeKind value.");
|
||||
}
|
||||
}
|
||||
#else
|
||||
public static string ToDateTimeFormat(DateTimeKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case DateTimeKind.Local:
|
||||
return "yyyy-MM-ddTHH:mm:sszzzzzzz";
|
||||
case DateTimeKind.Unspecified:
|
||||
return "s";
|
||||
case DateTimeKind.Utc:
|
||||
return "yyyy-MM-ddTHH:mm:ssZ";
|
||||
default:
|
||||
throw new Exception("Unexpected DateTimeKind value.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal static DateTime EnsureDateTime(DateTime value, DateTimeZoneHandling timeZone)
|
||||
|
||||
Reference in New Issue
Block a user