function daysSinceGivenDate(date: Date) {
const dateInSeconds = Math.floor((new Date().valueOf() - new Date(date).valueOf()) / 1000);
const oneDayInSeconds = 86400;
return (dateInSeconds / oneDayInSeconds) | 0; // casted to int
}
console.log(daysSinceGivenDate(new Date())); // 0