-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Deserialization of TimeOnly fails for "HH:mm" formatted times #2810
Comments
I am seeing this issue when I try to retrieve "09:00" from Cosmos. Can this change be merged soon? The solution seems to reasonable. |
+1 |
This is my temporary workaround while waiting for the issue to be fixed.
|
To add to @michelebenolli workarround:
Then use it like so:
It is a bit of a workaround so I hope that this change will be merged after all this time. However, it does make you learn about how serialization/deserialization works :). Some sites I used for this information: |
Deserialization of
TimeOnly
fails for theHH:mm
format - the seconds is required.This leads to compatibility issues since
HH:mm
is the default format returned by HTML<input type="time" />
The similar
TimeSpan
properly deserializes this format.Source/destination types
Source/destination JSON
"17:05"
Expected behavior
The time is deserialized as 17:05
Actual behavior
Error converting value "17:05" to type 'System.TimeOnly'.
Steps to reproduce
The text was updated successfully, but these errors were encountered: