I have a code script to calculate the number of days between today and an expected day:
let date1 = new Date(); //today
let date = new Date("04/19/2022") //expected day
let differenceInTime = date1.getTime() - date.getTime(); //difference by milliseconds
let differenceInDay = (differenceInTime - differenceInTime%(1000 * 3600 * 24))/(1000 * 3600 * 24); // JS does not supports dividing by whole so I implement this to get the number of days
The result is true for every cases, except that when I choose the day after today (tomorrow) as expected day, the result also is 0. Is there something not exact in my code?