Hi Ankit,
Greetings from Syncfusion support.
We have checked the reported requirement. We suspect that, you have enabled the strictMode for DatePicker component. If you enabled the strictMode, when enter the invalid date then input element will be cleared.
And in the strictMode the error class will not be added when you choose the invalid date. But, in the normal mode the error class will be added to the wrapper of the component if you enter the invalid date. So we suggest to disable the strictMode, and display the error message using the e-error class. In the blur event, we can clear the input element value If the date is invalid. Kindly refer the below code,
};
onBlur(e){
if(e.model.inputWrapper.container.classList.contains('e-error')){
e.model.inputElement.value = null;
document.getElementById('errorMessage').style.display = "block";
document.getElementById('errorMessage').innerText = "Invalid Date";
}
else {
document.getElementById('errorMessage').style.display = "none";
}
}
|
Please find the sample below,
Regards,
Sevvandhi N