I started to learn Node.js. But I don't understand how to work with time, my question is probably not correct. But I will be grateful for any answer.
add one day to the current date:
var date = new Date();
var ok = date.setDate(date.getDate() + 1)
var result = new Date(ok);
console.log(result.toLocaleString())
Now I want to compare, down to the seconds, whether a given date has passed from the current
I found this code on my search:
But I doubt it's right for me.
var givenDate = new Date('June 7, 2022');
if (Date.now() > givenDate.getTime()) {
// the date has passed
} else {
// the date has not passed
}