How to check if input date is equal to today date in TypeScript

1 Answer

0 votes
const inputDate = new Date("5/14/2022"); // m/dd/yyyy
 
const todaysDate = new Date();
 
if (inputDate.setHours(0,0,0,0) == todaysDate.setHours(0,0,0,0)) {
    console.log("equal");
} else {
        console.log("not equal");
}
   
   
   
   
   
/*
run:
   
"not equal" 
   
*/

 



answered May 6, 2022 by avibootz
...