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

146
Visualizações
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 Respostas
Responde à pergunta

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 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