I'm using DateOnly property. When I bind it in input it doesn't bind in default date time picker while I'm in my update view. Though When I inspect it the "input" element has value but it doesn't bind in my calender. Is this due to new DateOnly Property.?? As when I was using DateTimeOffset it was perfectly working
Asked
Active
Viewed 525 times
0
-
Not that hard to implement. Start with https://learn.microsoft.com/en-us/aspnet/core/mvc/advanced/custom-model-binding?view=aspnetcore-6.0#implementing-a-modelbinderprovider returning a binder based on https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.Core/src/ModelBinding/Binders/DateTimeModelBinder.cs swapping `DateTime` with `DateOnly`. – Jeremy Lakeman Aug 09 '22 at 06:45
1 Answers
0
DateOnly
and TimeOnly
hasn't support full Model Binding freature in .Net 6(refer to this github issue), I have tested that It has been provided in .Net 7.
If you want to use DateOnly
, you can try to use JsonConverter
, Refer to link.

Xinran Shen
- 8,416
- 2
- 3
- 12