I have a datepicker that needs to take the date "12/31/9999" even though maxDate is set to today.
I have it type in like this. However, when I run the comparison in the code, it returns false.
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;
}
}
However, when I compare form.controls["date"].value to new Date("12/31/9999") it comes back as false and doesn't execute my code in the middle.
Why is that? Here is a copy/paste of the immediate window checking the values
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