// Compare two dates (times) in JS const ONE_DAY = 86400000; const today = new Date(); const yesterday = new Date(Number(today) - ONE_DAY); console.log(yesterday < today); // true