Skip to content

Add documentation for date formats in S.T.JSON #30037

Closed
dotnet/docs
#13526

Description

@rynowak

Filing this per @ahsonkhan request

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.

Activity

  1. ahsonkhan commented on Jun 26, 2019

    @ahsonkhan
    Contributor
  2. self-assigned this
    on Jun 26, 2019
  3. layomia commented on Jun 27, 2019

    @layomia
    Contributor
  4. ericstj commented on Jul 1, 2019

    @ericstj
    Member

    @JeremyKuhne are you working on this one?

  5. JeremyKuhne commented on Jul 1, 2019

    @JeremyKuhne
    Member

    Yeah, I'll take this.

  6. ericstj commented on Jul 16, 2019

    @ericstj
    Member
  7. ahsonkhan commented on Jul 16, 2019

    @ahsonkhan
    Contributor

    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.

  8. ahsonkhan commented on Aug 22, 2019

    @ahsonkhan
    Contributor

    With this doc PR merged (dotnet/docs#13526), I believe the work left is to
    link the doc from the relevant APIs:

    We should probably reference it from the relevant portions of the API docs.

    Utf8JsonReader and JsonElement GetDateTime{Offset}, and WriteString{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)

  9. ericstj commented on Aug 29, 2019

    @ericstj
    Member

    @layomia can this be closed now?

  10. layomia commented on Aug 31, 2019

    @layomia
    Contributor

    @ericstj I'll close this with dotnet/docs#14056 cc @ahsonkhan.

  11. ahsonkhan commented on Sep 9, 2019

    @ahsonkhan
    Contributor

    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.

  12. layomia commented on Sep 19, 2019

    @layomia
    Contributor

    Closing, following the merging of dotnet/samples#1418 and dotnet/docs#14056.

  13. transferred this issue fromdotnet/corefxon Feb 1, 2020
  14. added this to the 3.0 milestone on Feb 1, 2020
  15. ghost locked as resolved and limited conversation to collaborators on Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-System.Text.Jsondocumentationjson-functionality-doc

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions