From 7c0a577f61c1fd9c965df516671b29f80a8487ee Mon Sep 17 00:00:00 2001 From: Layomi Akinrinade Date: Mon, 27 Jan 2020 13:55:55 -0800 Subject: [PATCH 1/2] Add note about ommited fractional seconds when formatting DT(Offset)s in System.Text.Json --- .../datetime/system-text-json-support.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/standard/datetime/system-text-json-support.md b/docs/standard/datetime/system-text-json-support.md index b52874fa46231..00031b824bae1 100644 --- a/docs/standard/datetime/system-text-json-support.md +++ b/docs/standard/datetime/system-text-json-support.md @@ -222,4 +222,20 @@ The following levels of granularity are defined for formatting: Used to format a or with fractional seconds and with a local offset. -If present, a maximum of 7 fractional digits are written. This aligns with the implementation, which is limited to this resolution. +If the [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) representation of a + or instance has trailing zeros in its fractional seconds, then +and will format a represenation of the instance without trailing zeros. +For example, a instance whose [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) +representation is `2019-04-24T14:50:17.1010000Z`, will be formatted as `2019-04-24T14:50:17.101Z` by +and . + +If the [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) representation of a + or instance has all zeros in its fractional seconds, then +and will format a represenation of the instance without fractional seconds. +For example, a instance whose [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) +representation is `2019-04-24T14:50:17.0000000+02:00`, will be formatted as `2019-04-24T14:50:17+02:00` by +and . + +Truncating zeros in fractional-second digits allows the smallest output needed to round-trip to be written. + +If present, a maximum of 7 fractional-second digits are written. This aligns with the implementation, which is limited to this resolution. From 1bf93beb9e51a9dd13f7ffbc162cc2a578564db5 Mon Sep 17 00:00:00 2001 From: Layomi Akinrinade Date: Tue, 28 Jan 2020 13:44:07 -0800 Subject: [PATCH 2/2] Address review feedback --- docs/standard/datetime/system-text-json-support.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/standard/datetime/system-text-json-support.md b/docs/standard/datetime/system-text-json-support.md index 00031b824bae1..f3c4618c1b5d2 100644 --- a/docs/standard/datetime/system-text-json-support.md +++ b/docs/standard/datetime/system-text-json-support.md @@ -224,18 +224,18 @@ The following levels of granularity are defined for formatting: If the [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) representation of a or instance has trailing zeros in its fractional seconds, then -and will format a represenation of the instance without trailing zeros. +and will format a representation of the instance without trailing zeros. For example, a instance whose [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) representation is `2019-04-24T14:50:17.1010000Z`, will be formatted as `2019-04-24T14:50:17.101Z` by and . If the [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) representation of a or instance has all zeros in its fractional seconds, then -and will format a represenation of the instance without fractional seconds. +and will format a representation of the instance without fractional seconds. For example, a instance whose [round-trip format](../base-types/standard-date-and-time-format-strings.md#the-round-trip-o-o-format-specifier) representation is `2019-04-24T14:50:17.0000000+02:00`, will be formatted as `2019-04-24T14:50:17+02:00` by and . -Truncating zeros in fractional-second digits allows the smallest output needed to round-trip to be written. +Truncating zeros in fractional-second digits allows the smallest output needed to preserve information on a round trip to be written. -If present, a maximum of 7 fractional-second digits are written. This aligns with the implementation, which is limited to this resolution. +A maximum of 7 fractional-second digits are written. This aligns with the implementation, which is limited to this resolution.