If I try to enter 2/29/2020 via the keyboard in a DatePicker, the day is automatically changed to 28 when I have typed 2/29/2. Indeed, this behavior can be enhanced, so that when we enter an invalid date like 2/29/2, the value should not be auto-corrected but set to null (this is the default behavior of a default HTML input element)
Check the following example:
https://stackblitz.com/edit/angular-bno7qd?file=app/app.component.ts
Try entering the date 2/29/2020 in both inputs and compare their functionalities.
Also mentioned in private support thread â„– 1416850
If the entered date is 28th of February (28/02/2019) and a new date is entered (e.g. 31/12/2019), after typing the first "3" the focus is immediately moved to the month because there is no date in February which has two digits where the first one starts with "3".
https://stackblitz.com/edit/angular-fvy3pp
Try entering the date 31/12/2019 when the entered date is in February.
Linked to a public Feedback portal feature request:
https://feedback.telerik.com/kendo-angular-ui/1417908-datevalidation
Is there any progress made on this ticket? We are running into this issue, and it is annoying...
Is there any way to turn the auto correction completely off? I'm developing a product where the last day of the month will be a big deal and I would rather the user be able to type any invalid value and possibly get a validation error than to have it auto-correct and risk them not noticing that the incorrect value was entered.
We otherwise love the functionality of it, but anticipate this piece causing problems down the line.
No, currently the DateInputs work only with a masked input. Turning that functionality off would be no simple task, and is unfortunately not supported currently. We are considering adding the option to use a plain input inside the DateInput, however, this is not something in our immediate plans.
I would also appreciate an option to turn this behavior off as long as there is no permanent fix for this matter. Alternatively debounce it or validate the user input after the field loses focus. The native date input does a decent job in that regard.
@dtopalov why isn't this a bug if you can't change the date from 28th of February to the 31th of March?
@cwuethrich, this isn't a bug as the DateInput currently doesn't support validating the passed value on blur. It updates the value on input. And as trying to set 31 for date value is invalid for the month of February, the input is prevented, which is exactly the expected behavior.
As mentioned before, the options are to either validate the mask value on blur, or provide a plain input for the value which is parsed on certain events. And both of these fall under the category of enhancements.
Still, I do understand that this behavior can lead to mistakes in end-user input at times, so we'll review if we could give higher priority to this issue.
Most helpful comment
@dtopalov why isn't this a bug if you can't change the date from 28th of February to the 31th of March?