Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

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

7 months 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')

7 months 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 job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.