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

222
Views
check if more than 7 days are selected using momentjs

how can i check if more than 7 days are selected on calendar. I want to disable one button on the basis of this condition.

fromDate and toDate are global states in which i am setting date from calendar. Little bit confuse now.

{moment(fromDate, toDate).format("yyyy-MM-DD") >
      moment().subtract(6, "days") ? (
        <li className="nav-item disabled">
          <a className="nav-link disabled">Hourly</a>
        </li>
      ) : (
        <li className="nav-item">
          <a
            className={`nav-link${
              selectedOption === "hourly" ? " active" : ""
            }`}
            onClick={() => updatedSwitchData("hourly")}
          >
            Hourly
          </a>
        </li>
      )}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use diff method to check difference between two days.

var diff = moment(toDate).diff(fromDate, 'days')
alert('difference :' + diff)

alert('is difference more than 7: ' + (diff > 7))
about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!