-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DateOnly and TimeOnly support to System.Text.Json #69160
Add DateOnly and TimeOnly support to System.Text.Json #69160
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsFix #53539.
|
@eiriktsarpalis will this address serialization failures when |
Yes, the |
Thank you! That was the piece I was missing. Works great now 😄 |
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DateOnlyConverter.cs
Outdated
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DateOnlyConverter.cs
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/TimeOnlyConverter.cs
Show resolved
Hide resolved
...ries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/RealWorldContextTests.cs
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DateOnlyConverter.cs
Show resolved
Hide resolved
.../System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationContextTests.cs
Show resolved
Hide resolved
...es/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/TimeOnlyConverter.cs
Show resolved
Hide resolved
...ries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
Outdated
Show resolved
Hide resolved
…r.cs Co-authored-by: Layomi Akinrinade <[email protected]>
...tem.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Converters.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/ContextClasses.cs
Outdated
Show resolved
Hide resolved
@@ -13,6 +13,7 @@ private struct DateTimeParseData | |||
public int Year; | |||
public int Month; | |||
public int Day; | |||
public bool IsCalendarDateOnly; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it would help with #69447 (comment), but defining this field here will increase the size of this struct from 40 bytes to 48 bytes on 64-bit. If you instead move this field to the end, the size should stay at 40.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not seeing a difference in benchmarks when I rearrange the fields, but I could try pushing the change and see if it registers in the performance infrastructure.
Fix #53539.