Visitar URL original
Add built-in support for .NET 6 `DateOnly` and `TimeOnly` types by AArnott · Pull Request #1427 · MessagePack-CSharp/MessagePack-CSharp · GitHub
Skip to content

Add built-in support for .NET 6 DateOnly and TimeOnly types - #1427

Merged
AArnott merged 3 commits into
MessagePack-CSharp:developfrom
AArnott:fix1240_dateonly
May 24, 2022
Merged

AArnott merged 3 commits into
MessagePack-CSharp:developfrom
AArnott:fix1240_dateonly

Conversation

@AArnott

@AArnott AArnott commented Apr 26, 2022

Copy link
Copy Markdown
Collaborator

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.

Because TimeOnly uses 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

@AArnott AArnott added this to the v2.4 milestone Apr 26, 2022
@AArnott
AArnott requested a review from neuecc April 26, 2022 15:34

@neuecc neuecc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@AArnott

AArnott commented May 24, 2022

Copy link
Copy Markdown
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.
But sure, I don't have a strong objection so I'll redo with long ticks for TimeOnly.

@AArnott
AArnott force-pushed the fix1240_dateonly branch from 13637a1 to 1974603 Compare May 24, 2022 02:48
@neuecc

neuecc commented May 24, 2022

Copy link
Copy Markdown
Member

Ok, thanks!

@AArnott
AArnott force-pushed the fix1240_dateonly branch from 1974603 to 513c198 Compare May 24, 2022 13:31
AArnott and others added 3 commits May 24, 2022 10:08
`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
@AArnott
AArnott force-pushed the fix1240_dateonly branch from 513c198 to 14ed43c Compare May 24, 2022 16:10
@AArnott
AArnott merged commit 623aaf2 into MessagePack-CSharp:develop May 24, 2022
@AArnott
AArnott deleted the fix1240_dateonly branch May 24, 2022 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants