I want to find out if the current UTC time is at least 12 hours bigger than the given UTC time. The given UTC time always consists of UTCyear, UTCmonth, UTCdate, UTChour and UTCminute.
I have tried it with the code provided in the answer from the user Titulum, but it's not always working. For example, the code is not working in this case:
function isOlderThan12Hours(dateToCheck)
{
return Date.now() - dateToCheck > 43200;
}
const year = 2020;
const month = 3; // April
const date = 17;
const hour = 11;
const minute = 39;
const valuesAsDate = new Date(`${year}-${month+1}-${date}T${hour}:${minute}:00.000Z`);
In this case, valuesAsDate is "Invalid Date".
How can I find out if the current UTC time is at least 12 hours bigger than the given UTC time?