How to pass an array of dates to selectedDays? #1178
Answered
by
gpbl
MattHeslington
asked this question in
Support
-
Hello, I'm using react-day-picker to display a calendar in which I would like to show all the dates of posts on a 'blog'. Users then click on a day to view that day's post. It works very well if I pass the dates in manually (dateArray is an array of dates): <DayPicker
onDayClick={handleDayClick}
selectedDays={[
new Date(dateArray[0]),
new Date(dateArray[1]),
new Date(dateArray[2]),
etc....
]}
/> However, is it possible to just pass in the 'dateArray' without the [0], [1] etc. so as to make it truly dynamic? Many thanks for any help, |
Beta Was this translation helpful? Give feedback.
Answered by
gpbl
Mar 11, 2021
Replies: 1 comment 1 reply
-
@MattHeslington I suspect that dateArray contains strings? What is its content? You can also write:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
MattHeslington
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@MattHeslington I suspect that dateArray contains strings? What is its content? You can also write: