I want to highlight the next two weeks from the current date. I am using react-datepicker module. I used the below code:
var currentDate = new Date();
var numberOfDaysToAdd = 13;
const daysHighlighted = new Array(numberOfDaysToAdd).fill(currentDate);
return (
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
highlightDates={[{
"react-datepicker__day--highlighted": daysHighlighted.map((day, index) => {
day.setDate(day.getDate() + index)
return new Date(day)
})
}]}
/>
)
Which is giving me the unexpected result.
I just want to highlight next two weeks including current Date.