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

129
Vistas
getDay() function of "date-fns" gives different results for the same date

Given the following 2 dates in ISO format:

2022-08-28T01:00:00.000Z
2022-08-28T23:00:00.000Z

getDay() returns 0 for the first one, and 1 for the second one.

Note that it's the same date, and only time is changed.

I am assuming it returns the result after converting it to local time. Because of that behavior, my logic has some side-effects.

Is there a way to get the result without conversion to local time?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The getDay documentation clearly states it returns results in local time. You need the getUTCDay function.

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