Last Updated: 18 Mar 2019 09:59 by ADMIN
Created on: 27 Jul 2018 09:50
Category: DatePicker
Type: Feature Request
DatePicker: Validation of incomplete input
If a DatePicker input is set to not required and a user enters an incomplete date like 05/day/2018, the component does not recognize the value and the input is null. This behaviour is ok, the problem is, that no validation is triggered.
In such a case, a validation error should be thrown such as "incomplete date" or "invalid", but nothing happens. To allow the form validation of an incomplete date, such a validation is needed.
Dimiter Topalov
Posted on: 18 Mar 2019 09:59

Thank you for creating this feature request. We will track the customer demand here, and prioritize accordingly when updating our roadmap.

Meanwhile, I will share the currently available solution, previously discussed in a private support thread, so others can benefit too:

Access the internal properties of the DatePicker programmatically and apply some custom logic for differentiating between no input and partial input. Here is a sample implementation of the described approach (note that this is not officially supported):


Handle the blur event and access the string value of the underlying input via componentInstance.input.currentValue:

Apply the custom logic that will determine when the control should be invalidated:

if(stringValue.match(/[A-Za-z]/)) { // value contains a letter
        if(stringValue === 'month/day/year') { // value matches the empty placeholder
          // no value entered
        // incomplete value entered
        form.controls['birthDate'].setErrors({'incomplete': true});

Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Posted on: 12 Mar 2019 04:08
Same case here, we need to validate the input format of both the date input and time input as users may not aware he has input the wrong format and the result data will be invalid in his perspective