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

116
Visualizações
Getting date range to show true between 2 different years

I'm trying to get the months between 2 years, for example I have a project that starts on 2021-10-15 and it ends on 2022-05-03 and what I'm trying to do is get it to return true only for the months that is between those dates, so for example it would return true for oct, nov, dec, jan, feb, mar, apr, may.

The issue I have is that the way my code is it returns true but it goes from may - oct instead of oct - may.

Here is my code

dateRange(project, month){
    let startMonth = project.startDate.split('-')[1];
    let endMonth = project.endDate.split('-')[1];

    return month >= start_month && month <= end_month;
}
about 4 years ago · Juan Pablo Isaza
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