You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add documentation for date formats in S.T.JSON #30037
We don't have a good document to point users at for understanding how to use dates with System.Text.Json. JSON.NET was very tolerant in the set of date formats that it would accept, and this will be a common question. There's a lot of existing code out there that works with formats other than ISO 8601.
The other component of documentation is the workaround for working with non-ISO dates (which involves creating a custom JsonConverter). Including such samples would be quite helpful (particularly in the porting guide), and I vaguely recall @JeremyKuhne had written something up about custom converters to allow other DateTime formats to work.
There is just a bit of work left before we can close this issue, which involves closing on the location of the sample: dotnet/samples#1418
And update the doc accordingly: dotnet/docs#14056
@layomia - please work with the docs team to close on the pending PRs.
Activity
ahsonkhan commentedon Jun 26, 2019
cc @layomia
layomia commentedon Jun 27, 2019
cc @JeremyKuhne
ericstj commentedon Jul 1, 2019
@JeremyKuhne are you working on this one?
JeremyKuhne commentedon Jul 1, 2019
Yeah, I'll take this.
ericstj commentedon Jul 16, 2019
We should create a topic document that summarizes the algorithm here:
https://github.com/dotnet/corefx/blob/6cd505d9aaabe656707766dee22e9aec0404568f/src/System.Text.Json/src/System/Text/Json/JsonHelpers.Date.cs#L88-L423
And how this relates to https://github.com/dotnet/docs/blob/ef122199e3f0a37761974e4de5ed9fcd36cd7cbe/docs/standard/base-types/standard-date-and-time-format-strings.md
This probably belongs in its own markdown file in the docs repo. To start lets draft a markdown and open a PR in docs repo in some place like https://github.com/dotnet/docs/tree/master/docs/core, https://github.com/dotnet/docs/tree/master/docs/standard and tag @mairaw to get this hooked up correctly into the doc tree. We should probably reference it from the relevant portions of the API docs.
ahsonkhan commentedon Jul 16, 2019
The other component of documentation is the workaround for working with non-ISO dates (which involves creating a custom JsonConverter). Including such samples would be quite helpful (particularly in the porting guide), and I vaguely recall @JeremyKuhne had written something up about custom converters to allow other DateTime formats to work.
ahsonkhan commentedon Aug 22, 2019
With this doc PR merged (dotnet/docs#13526), I believe the work left is to
link the doc from the relevant APIs:
Utf8JsonReaderandJsonElementGetDateTime{Offset}, andWriteString{Value}(DateTime{Offset})APIs are good candidates. For example:https://docs.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonreader.getdatetime?view=netcore-3.0#System_Text_Json_Utf8JsonReader_GetDateTime
https://docs.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonwriter.writestringvalue?view=netcore-3.0#System_Text_Json_Utf8JsonWriter_WriteStringValue_System_DateTimeOffset_
And add reader/writer/document related documentation:
dotnet/docs#13526 (comment)
ericstj commentedon Aug 29, 2019
@layomia can this be closed now?
layomia commentedon Aug 31, 2019
@ericstj I'll close this with dotnet/docs#14056 cc @ahsonkhan.
ahsonkhan commentedon Sep 9, 2019
Given this issue is about documentation, and we already have a doc published that covers most of the scenarios, moving this to 5.0.
https://docs.microsoft.com/en-us/dotnet/standard/datetime/system-text-json-support
There is just a bit of work left before we can close this issue, which involves closing on the location of the sample:
dotnet/samples#1418
And update the doc accordingly:
dotnet/docs#14056
@layomia - please work with the docs team to close on the pending PRs.
layomia commentedon Sep 19, 2019
Closing, following the merging of dotnet/samples#1418 and dotnet/docs#14056.