I am currently trying to add a Custom Header to my react-datepicker calendar. However my calendar also displays multiple months so when I use the renderCustomHeader prop, it only adds a custom header to the first calendar displayed and the second calendar ends up with no header.
This is what the code currently looks like:
<DatePicker
renderCustomHeader={({
date,
changeYear,
changeMonth,
decreaseMonth,
increaseMonth,
prevMonthButtonDisabled,
nextMonthButtonDisabled
}) => (
<div
style={{
margin: 10,
display: 'flex',
justifyContent: 'center'
}}
>
<button onClick={decreaseMonth} disabled={prevMonthButtonDisabled}>
{'<'}
</button>
<select
value={date.getFullYear()}
onChange={({ target: { value } }) => changeYear(value)}
>
{years.map(option => (
<option key={option} value={option}>
{option}
</option>
))}
</select>
<select
value={months[date.getMonth()]}
onChange={({ target: { value } }) =>
changeMonth(months.indexOf(value))
}
>
{months.map(option => (
<option key={option} value={option}>
{option}
</option>
))}
</select>
<button onClick={increaseMonth} disabled={nextMonthButtonDisabled}>
{'>'}
</button>
</div>
)}
selected={startDate}
onChange={ date => onChange(date) }
renderDayContents={renderDayContents}
monthsShown={2}
/>
How can I target the second calendar to add a Custom Header?