Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
if statement with dates js

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!