How can i check if input date is Today, Yesterday or just return the date if it's noone of them?
I was trying to do the following:
const checkDate = (someDate) => {
const today = new Date();
let date = new Date(someDate);
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
return date.getTime() === today.getTime() ? "Oggi" : date.getTime() === today.setDay(-1) ? "Ieri" : "Il" + date;
}
console.log(checkDate("December 17, 1995 03:24:00"));
Where "Oggi" is Today and "Ieri" is Yesterday..