I have this:
let currentTime = new Date(customerid)
currentTime = currentTime.setDate(currentTime.getDate());
customerid = new Date(customerid)
currentTime = new Date(currentTime)
console.log(customerid)
console.log(currentTime)
if (customerid == currentTime) {
res.redirect('/create-checkout-session')
} else {
console.log("having to go into loading screen")
res.redirect("/loadingscreen")
}
When i log what is happening:
console.log(customerid)
console.log(currentTime)
It returns this:
2022-02-13T00:00:00.000Z
2022-02-13T00:00:00.000Z
whcih I thought was fine, however, I then do the if statement logic, and it doesn't work, it goes into the else.
so when I do:
if (customerid == currentTime) {
it says it is not the same, although the output above shows that it is. Am i not able to do if logic with date paramaters? How should i fix this?