Add support for DateOnly/TimeOnly into xml serializer#7692
Add support for DateOnly/TimeOnly into xml serializer#7692danielmarbach merged 7 commits intomasterfrom
Conversation
tmasternak
left a comment
There was a problem hiding this comment.
I'm leaning towards the approach indicated by Daniel - explicit type handling
|
I dug a little deeper because I was wondering how DateTime and DateTimeOffset are handled internally. I found out that XElement has native support for that and started wonder why we even have to do anything. This made me find this gem dotnet/runtime#119835 |
|
Raised dotnet/runtime#126879. |
|
Looking at the .NET runtime PR, the wire formats are:
Our current "O" format for TimeOnly produces 14:30:25.1230000 with trailing zeros, while the runtime uses a minimal form like 14:30:25.123. Should we use yyyy-MM-dd and HH:mm:ss.fffffff (trimmed) instead of "O" to match the .NET runtime behavior? Or is our current "O" format acceptable since it's also a valid roundtrip format? |
Yeah i saw that one too and was surprised that XElement was still using the plain |
I think "O" would be acceptable - It's not going to break anyone, but I think the trimmed version would be slightly better as it will generally drop 3 or more bytes from each message. |
Fix for #7126