System.Text.Json can't deserialize ISO dateTime to DateOnly #102594
Labels
area-System.Text.Json
enhancement
Product code improvement that does NOT require public API changes/additions
Milestone
Description
It looks like System.Text.Json cannot deserialize from ISO 8601 datetime string to DateOnly, which I find odd, since
DateOnly.Parse("2024-05-01T00:00:00")
works perfectly fine.Reproduction Steps
Here's the code:
Expected behavior
I'd expect no exception to be thrown and an isntance of
MyRecord
to be created.Actual behavior
An exception is thrown:
Regression?
No response
Known Workarounds
Use
DateTime
instead ofDateOnly
.Configuration
dotnet: 8.0.204
OS: Fedora 40
arch: x64
Other information
No response
The text was updated successfully, but these errors were encountered: