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

202
Vistas
Why does the date in October get miscalculated, date fns

I'm using the date-fns library and I have a logic that calculates the time from a given date depending on the number I specify.

For example:

number: 1 month

start date: 01/09/2020

end time: (is calculated automatically according to the code below)

const startDate = new Date("the date that gets 01/09/2020 in this case")
endTime= add(sub(startDate, {seconds: 1}), {months: numberOfPeriods}).toUTCString();

In all months it looks ok, but I have a problem with October, because it gets like an extra 2 hour and then it doesn't calculate it right.

Does anyone have any ideas? I am sending ss from consol which shows calculated endTime

enter image description here

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