Skip to content

For net6, support DateOnly and TimeOnly #1240

Closed

Description

@AArnott

Add built-in support on .NET 6 for the new DateOnly and TimeOnly types as described here: dotnet/runtime#50980

Activity

  1. simonziegler commented on Jun 18, 2021

    @simonziegler

    Hi @AArnott - I'm keen to use DateOnly in my project as soon as possible. I need to cut over from DateTime to DateOnly before I commit to a database scheme ahead of imminent release. MessagePack is central to my project and I wonder if you can suggest a work around to allow me to use DateOnly before MessagePack is ready. Here is the exception I get indicating the relevant resolver:

    MessagePack.MessagePackSerializationException: Failed to serialize MyProject.MyClass value.
     ---> MessagePack.FormatterNotRegisteredException: System.DateOnly is not registered in resolver: MessagePack.Resolvers.CompositeResolver+CachingResolver
    

    Please ignore this - I inspected what MessagePack does for DateTime and built my own formatter and resolver. Instead of DateTime.ToBinary() I used DateOnly.Daynumber, which is an int.

  2. github-actions commented on Sep 17, 2021

    @github-actions
    Contributor

    This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

  3. kzu commented on Dec 13, 2021

    @kzu
    Contributor

    I think this issue should be reopened and actually fixed :)

  4. ordinaryorange commented on Jan 24, 2022

    @ordinaryorange

    I see DateTime uses the .ToBinary() method during serialization.
    Under the hood .ToBinary() attempts some conversions to account for localtime, but DateOnly has no concept of localtime/UTC etc
    DateOnly does not have a .ToBinary() equiv so the easiest way out of this to simply use the DayNumber property and just serialize the int.

  5. github-actions commented on Apr 26, 2022

    @github-actions
    Contributor

    This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

  6. self-assigned this
    on Apr 26, 2022
  7. added a commit that references this issue on Apr 26, 2022
    13637a1
  8. AArnott commented on Apr 26, 2022

    @AArnott
    CollaboratorAuthor

    I invite anyone interested in this feature to review my PR and comment on the format I'm using for these types.

  9. added 3 commits that reference this issue on May 24, 2022
    1974603
    d255f30
    c7ef724
  10. added this to the v2.4 milestone on May 24, 2022
  11. PatrickDRusk commented on Jun 6, 2022

    @PatrickDRusk

    Is there a schedule by when this will appear in a Nuget package?

  12. AArnott commented on Jun 7, 2022

    @AArnott
    CollaboratorAuthor

    No. It's kind of on an on-demand basis. So your vote of interest is enough to move the wheel a bit. I'll try to review other active issues to see if we have anything else we can roll into another prerelease of 2.4.

  13. PatrickDRusk commented on Jun 9, 2022

    @PatrickDRusk

    It would be much appreciated. Thanks.

  14. AArnott commented on Jun 9, 2022

    @AArnott
    CollaboratorAuthor

    It's now out. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions