Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda