Add built-in support for .NET 6 DateOnly and TimeOnly types#1427
Merged
AArnott merged 3 commits intoMessagePack-CSharp:developfrom May 24, 2022
Merged
Add built-in support for .NET 6 DateOnly and TimeOnly types#1427AArnott merged 3 commits intoMessagePack-CSharp:developfrom
DateOnly and TimeOnly types#1427AArnott merged 3 commits intoMessagePack-CSharp:developfrom
Conversation
neuecc
reviewed
May 16, 2022
Member
neuecc
left a comment
There was a problem hiding this comment.
If DateOnly uses DayNumber as int, why not TimeOnly just use Ticks as long?
Seems like a bad idea to use an extension for this.
Collaborator
Author
|
Is it really that appropriate to use a msgpack primitive type to represent a value that isn't meant to be interpreted as a primitive? I'm on the fence at the moment on that point. |
Member
|
Ok, thanks! |
`DateOnly` requires 5 bytes (typically). `TimeOnly` requires 6 bytes for second resolution or 8 bytes for ticks resolution. This is automatically selected based on the original value. Closes MessagePack-CSharp#1240 # Conflicts: # src/MessagePack/net6.0/PublicAPI.Unshipped.txt
This was referenced Oct 26, 2025
This was referenced Dec 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DateOnlyrequires 5 bytes (typically).TimeOnlyrequires 6 bytes for second resolution or 8 bytes for ticks resolution. This is automatically selected based on the original value.Because
TimeOnlyuses an extension, I claim another extension type code. I venture to add documentation to the README to actually reserve a range of type codes for this and future use, where this previously wasn't done, which makes every additional type code we use risky because it may collide with a user of this library's custom extensions.Closes #1240