Is there a property to change to months index to start at 1 instead of zero, ie march = 3 but the output on the calendar is april, I can manually do this but its very hacky
Anyone know if there a property I can set on this library react-calendar The library
you need to do few things. 1- set Min and max date value
const startDate = new Date(new Date().getFullYear(), new Date().getMonth(), 1)
const endDate = new Date(new Date().getFullYear(), new Date().getMonth(), 31)
then you need to specify those values within the calendar
<Calendar
data-name="yourselectionName"
data-value={hooksVariable}
onChange={hooksUpdateMethod}
value={currentDate}
minDate={startDate}
maxDate={endDate}
name={name}
/>
by then only dates in range will be selectable but you still need to hide date that are not within range using css by this:
.react-calendar__month-view__days__day--neighboringMonth {
display: none !important;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.