I’m using the react-day-picker component and the numberOfMonths variable to set the month’s display.
The current display shows the current month and next month, but I’m trying to show the previous month and the current month.
Current Code
<DayPicker
mode="range"
selected={selectedRange}
onSelect={handleRangeSelect}
numberOfMonths={2}
/>
>Solution :
As per the documentation, you should use defaultMonth prop to change the initially displayed month. If you want to control the months yourself you can use the month prop instead of defaultMonth and use the onMontChange even to set it.