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
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.
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.
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.
Activity
simonziegler commentedon Jun 18, 2021
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:Please ignore this - I inspected what MessagePack does for
DateTimeand built my own formatter and resolver. Instead ofDateTime.ToBinary()I usedDateOnly.Daynumber, which is anint.github-actions commentedon Sep 17, 2021
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.
kzu commentedon Dec 13, 2021
I think this issue should be reopened and actually fixed :)
ordinaryorange commentedon Jan 24, 2022
I see DateTime uses the
.ToBinary()method during serialization.Under the hood
.ToBinary()attempts some conversions to account for localtime, butDateOnlyhas no concept of localtime/UTC etcDateOnlydoes not have a.ToBinary()equiv so the easiest way out of this to simply use theDayNumberproperty and just serialize theint.github-actions commentedon Apr 26, 2022
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.
Add built-in support for .NET 6 `DateOnly` and `TimeOnly` types
AArnott commentedon Apr 26, 2022
I invite anyone interested in this feature to review my PR and comment on the format I'm using for these types.
Add built-in support for .NET 6 `DateOnly` and `TimeOnly` types
Add built-in support for .NET 6 `DateOnly` and `TimeOnly` types
Add built-in support for .NET 6 `DateOnly` and `TimeOnly` types
PatrickDRusk commentedon Jun 6, 2022
Is there a schedule by when this will appear in a Nuget package?
AArnott commentedon Jun 7, 2022
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.
PatrickDRusk commentedon Jun 9, 2022
It would be much appreciated. Thanks.
AArnott commentedon Jun 9, 2022
It's now out. :)