When a DatePicker input is cleared by using the keyboard and the control loses focus, the state of a non-nullable DateTime property is inconsistent with the control.
This behavior is appropriate; however, it can cause user confusion when the underlying value is used to query for data based on a value the user no longer sees.
My proposed solution (bug fix) is to return the value of the DatePicker to the last known good value when the control loses focus.
StateHasChanged() by itself does not cause a re-render of the component, however changing the @key value of the DatePicker does.
See this REPL for a demonstration of the issue and workaround/fix: https://blazorrepl.telerik.com/czEjvVlK18i471S622
When using a DateTime? for input and a specific format, for example yyyy-MM-dd. If you just want to change the month part and type 03 the focus shifts to the start of the input and the month part gets replaced by MM.
Reproduce:
https://blazorrepl.telerik.com/QGYFEfPU52ceM2wL03
Select the month part and type 03 for example. If using a non nullable DateTime, this does not happen.
The picture says it all!