• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

153
Views
check if a date is between two dates in different years

I'm gonna use MomentJs or Dayjs to see if for instance Apr/03 is between Nov/01 and May/01.

When we try isBetween it doesn't work as in a year Nov/01 is not before Apr/03 but if you look at it as a two-year scop it should return true for moment('Apr/03').isBetween('Nov/01', 'May/01')

P.S. I cannot enter a year, for instance Apr/02/2021 is not an option.

Ok then, exports, what do you recommend?

about 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm going to assume the earlier bound will always be in the first year and the later bound will always be in the second year, otherwise it is pretty much impossible.

moment('Apr/03').isAfter('Nov/01') || moment('Apr/03').isBefore('May/01')

about 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error