Reputation: 6830
This is my problem link
I am passing dynamic date array and getting month based on the current date but it is not working.
This is reference link
Upvotes: 0
Views: 174
Reputation: 5054
You need to pass an array instead of function call in selectedDays
and you are passing date parameter wrong in selectedDaysS
function :
selectedDaysS = daysArr => {
let dataToSend = daysArr.map(a => {
let m = a.split('-');
return new Date(m[0], m[1], m[2]);
});
return dataToSend;
};
and inside render :
return (
<DayPicker
initialMonth={this.currentMonth()}
selectedDays={this.selectedDaysS(["2019-07-25"])}
/>
);
Here is live link : https://codesandbox.io/s/react-day-picker-examplesselected-nfbgz?fontsize=14
Upvotes: 3