Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!