diff --git a/Src/Newtonsoft.Json/DateFormatHandling.cs b/Src/Newtonsoft.Json/DateFormatHandling.cs index 55902c79..47efaf4b 100644 --- a/Src/Newtonsoft.Json/DateFormatHandling.cs +++ b/Src/Newtonsoft.Json/DateFormatHandling.cs @@ -1,8 +1,17 @@ namespace Newtonsoft.Json { + /// + /// Specifies how dates are formatted when writing JSON text. + /// public enum DateFormatHandling { + /// + /// Dates are written in the ISO 8061 format, e.g. "2012-03-21T05:40Z". + /// IsoDateFormat, + /// + /// Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". + /// MicrosoftDateFormat } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json/JsonConvert.cs b/Src/Newtonsoft.Json/JsonConvert.cs index 210db6ca..5682f8e7 100644 --- a/Src/Newtonsoft.Json/JsonConvert.cs +++ b/Src/Newtonsoft.Json/JsonConvert.cs @@ -93,10 +93,11 @@ namespace Newtonsoft.Json /// /// The value to convert. /// The format the date will be converted to. + /// The time zone handling when the date is converted to a string. /// A JSON string representation of the . - public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneOption) + public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling) { - DateTime updatedDateTime = EnsureDateTime(value, timeZoneOption); + DateTime updatedDateTime = EnsureDateTime(value, timeZoneHandling); using (StringWriter writer = StringUtils.CreateStringWriter(64)) { diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs index d982bd7d..c7fb0aa6 100644 --- a/Src/Newtonsoft.Json/JsonReader.cs +++ b/Src/Newtonsoft.Json/JsonReader.cs @@ -137,6 +137,9 @@ namespace Newtonsoft.Json protected internal set { _quoteChar = value; } } + /// + /// Get or set how time zones are handling when reading JSON. + /// public DateTimeZoneHandling DateTimeZoneHandling { get { return _dateTimeZoneHandling; } diff --git a/Src/Newtonsoft.Json/JsonSerializer.cs b/Src/Newtonsoft.Json/JsonSerializer.cs index 4f014331..e50c838a 100644 --- a/Src/Newtonsoft.Json/JsonSerializer.cs +++ b/Src/Newtonsoft.Json/JsonSerializer.cs @@ -285,24 +285,36 @@ namespace Newtonsoft.Json set { _context = value; } } + /// + /// Indicates how JSON text output is formatted. + /// public virtual Formatting Formatting { get { return _formatting ?? JsonSerializerSettings.DefaultFormatting; } set { _formatting = value; } } + /// + /// Get or set how dates are written to JSON text. + /// public virtual DateFormatHandling DateFormatHandling { get { return _dateFormatHandling ?? JsonSerializerSettings.DefaultDateFormatHandling; } set { _dateFormatHandling = value; } } + /// + /// Get or set how time zones are handling during serialization and deserialization. + /// public virtual DateTimeZoneHandling DateTimeZoneHandling { get { return _dateTimeZoneHandling ?? JsonSerializerSettings.DefaultDateTimeZoneHandling; } set { _dateTimeZoneHandling = value; } } + /// + /// Gets or sets the culture used when reading JSON. Defaults to . + /// public virtual CultureInfo Culture { get { return _culture ?? JsonSerializerSettings.DefaultCulture; } diff --git a/Src/Newtonsoft.Json/JsonSerializerSettings.cs b/Src/Newtonsoft.Json/JsonSerializerSettings.cs index 7ab24a31..729d58ad 100644 --- a/Src/Newtonsoft.Json/JsonSerializerSettings.cs +++ b/Src/Newtonsoft.Json/JsonSerializerSettings.cs @@ -127,24 +127,36 @@ namespace Newtonsoft.Json /// The context. public StreamingContext Context { get; set; } + /// + /// Indicates how JSON text output is formatted. + /// public Formatting Formatting { get { return _formatting ?? DefaultFormatting; } set { _formatting = value; } } + /// + /// Get or set how dates are written to JSON text. + /// public DateFormatHandling DateFormatHandling { get { return _dateFormatHandling ?? DefaultDateFormatHandling; } set { _dateFormatHandling = value; } } + /// + /// Get or set how time zones are handling during serialization and deserialization. + /// public DateTimeZoneHandling DateTimeZoneHandling { get { return _dateTimeZoneHandling ?? DefaultDateTimeZoneHandling; } set { _dateTimeZoneHandling = value; } } + /// + /// Gets or sets the culture used when reading JSON. Defaults to . + /// public CultureInfo Culture { get { return _culture ?? DefaultCulture; } diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index 9d4e48b2..6e7f62f5 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -204,7 +204,7 @@ namespace Newtonsoft.Json private DateTimeZoneHandling _dateTimeZoneHandling; /// - /// Indicates how the output is formatted. + /// Indicates how JSON text output is formatted. /// public Formatting Formatting { @@ -212,12 +212,18 @@ namespace Newtonsoft.Json set { _formatting = value; } } + /// + /// Get or set how dates are written to JSON text. + /// public DateFormatHandling DateFormatHandling { get { return _dateFormatHandling; } set { _dateFormatHandling = value; } } + /// + /// Get or set how time zones are handling when writing JSON. + /// public DateTimeZoneHandling DateTimeZoneHandling { get { return _dateTimeZoneHandling; }