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>
)}