Pending Review
Last Updated: 23 May 2025 15:52 by Joe
Joe
Created on: 23 May 2025 15:52
Category: UI for Blazor
Type: Bug Report
6
date picker invalid
There is a date picker bug where if you change the value to something invalid (ex: backspace the date or a portion of it), it will still be bound to the previous date value selected. If you click the picker and select the same date again, it will not register it as a date change and will not fire the value changed event. This causes the field to still show as invalid. To the end-user, it looks as if there is a problem and is telling them it is invalid. I had a customer notice this and they kept trying to reselect the date but nothing would happen. 

They eventually typed it manually to fix, which is one way that I agree can be used to resolve. You can also select the wrong date, followed by the right date to get around, but that is a horrible workaround. 

What I believe the experience should be is that when selecting the value in the date picker, regardless of what it thinks is in the field, it should fire the change event and update the text of the field to the date selected (and clear the validation message). That is what I'd like to see as a future change. Note that this happens on ValueChanged, but not OnChanged. OnChanged fires too late though, and doesn't work for most workflows.

We put in a hack solution in some operator UIs where it is very important to not have this happen, but it is a pain to do this for every picker, so most in the system are unhandled. 

The solution was to have OnOpen and OnBlur both manually trigger ValueChanged (which ends up sending default - 1/1/1901) using a reference for the control. This helps us differentiate if it is these events vs an actual date change. When it is OnOpen/OnBlur, we then reupdate the value in the reference and refresh. Note that you end up having to do this twice to "trick" the telerik logic. So we change to default, refresh, and then change to the correct (or last good value - what is already bound) and refresh. Basically now when they leave the field or click the picker, if there is an invalid value and message, it clears and gets replaced with the last good date. If there is a valid date, it does nothing from the user perspective.  
0 comments