Unplanned
Last Updated: 16 Mar 2022 16:17 by ADMIN
NovaStor
Created on: 08 Mar 2022 21:03
Category: DateTimePicker
Type: Bug Report
5
Do not revert to the previous value if an invalid date was entered

Hi.

When entering an invalid date in a DateTimePicker, the component will automatically revert the entered value back to its previous valid value.

I didn't expect this because the user may type in an invalid date, and continue to the next input control within the form, and not notice the error that was briefly displayed.

The issue can be reproduced in the DateTimePicker Demo here: https://demos.telerik.com/blazor-ui/datetimepicker/validation

Steps to reproduce:

1. Click in the day part of the date.

2. Enter 13

3. Enter 2100

4. Press the Tab key

5. Notice the date is automatically reverted (back) to 10/13/2019.

 

I expected the date to be set to 10/13/2100 with the input validation errors visible to the user after pressing the Tab key in step 4.

 

I've categorized this issue as a bug because otherwise, the form can be submitted with a value that the user did not enter.

 

If this behavior cannot be changed from being the default behavior, then there should be an option to prevent this behavior from happening.

 

Thank you.

1 comment
ADMIN
Dimo
Posted on: 16 Mar 2022 16:17

Hello,

The current behavior is by design, but we discussed it and agree we may need to change it or provide a configuration option.

What you can do now is bind the DatePicker to a nullable DateTime. In this case, an invalid value will clear the component textbox and the validator will kick in.

Regards,
Dimo
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.