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

150
Vistas
date-fns isSameWeek not working as expected

I'm new with date-fns but intuitively, I would expect this to be true:

isSameWeek(new Date(2021, 11, 11), new Date(2021, 11, 12))

But it actually is false

I must be missing something?

It looks like Thursday seems to be the start of the week because this is true:

isSameWeek(new Date(2021, 11, 12), new Date(2021, 11, 18))

EDIT: When I do this

isSameWeek(new Date(2021, 11, 11), new Date(2021, 11, 12), {weekStartsOn: 1})

It now is true... I'm confused.

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

0

The months start at 0 being January.

So 11 is December.

December 11 is a Saturday, the 12th is Sunday (start of the next week). So they are not in the same week.

December 12 is Sunday, December 18th is the Saturday of the same week. So they are in the same week.

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