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

200
Visualizações
Javascript date conversion is adding an hour from 0200 to 0300 on Daylight Savings Time. I want to prevent that from happening

I hit a recent problem where I'm validating dates to make sure a start date is not greater than an end date. The dates entered are start: 3/13/2022 02:30 end: 3/13/2022 03:15

When I convert these to dates in my code an extra hour is applied to the start date making it 03:30.The end date converts as expected and remained 03:30. Because of this my validation is getting hit and we see an error stating "start date cannot be greater than end date".

Am I missing something or how do I prevent this hour from being added?

I've tried changing the format of the date, but that didn't seem to make a difference.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think it depends on your system's local timezone, to compare those two dates, have you tried to convert them to timestamp ?

Maybe you could log the dates to the console using the date.toISOString() to see what they look like when converted to utc+0

about 4 years ago · Juan Pablo Isaza Relatório
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