Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda