I have an object that has an invalid date. I show this date in a table but I wanna say if the date is invalid then it should say "Future Date". My code is something like this:
for (let i = 0; i < res.data.length; i += 1) {
if (!(res.data[i].inspectionDate instanceof Date &&
!isNaN(res.data[i].inspectionDate))) {
res.data[i].inspectionDate = 'Futre Date';
}
}
but it still shows "Invalid Date" if the date is invalid. How can I display "Future Date" if the date is invalid?