I am facing an issue with my datepicker where it is not taking the date "12/31/9999" even though the maxDate is set to today.
https://i.sstatic.net/gjBoV.png
Despite inputting the date in the correct format, the comparison in the code returns false. Here is how I have implemented it:
private CheckDate(form: FormGroup, group: any) {
if (form.controls["date"].value == new Date("12/31/9999")) {
//form.controls["date"].valid = true;
(group.questions["date"] as DateTimePickerQuestion).maxDate = null;
}
}
On comparing form.controls["date"].value to new Date("12/31/9999"), it consistently returns false and fails to execute the intended code block.
I am puzzled by this behavior. Below are the values from the immediate window for reference:
new Date("12/31/9999")
Fri Dec 31 9999 00:00:00 GMT-0500 (Eastern Standard Time) {}
form.controls["date"].value
Fri Dec 31 9999 00:00:00 GMT-0500 (Eastern Standard Time) {}
form.controls["date"].value == new Date("12/31/9999")
false