Closed adityafuture01 closed 4 years ago
Please read the documentation thoroughly. initialDate
was never intended to select a date. Use selectedStartDate
to select one.
The initialDate is used to show the date as selected when calendar opens second time. I'm using this prop to show the previously selected date if user opens the calendar second time. So, when user opens the calendar again it should show the previously selected date as default. Currently, the calendar shows the month and year of previously selected date but not the day.
Inspect the source code and you'll see that initialDate
does not select a date. It only sets the month & year. Have you tried using selectedStartDate
?
@peacechen selectedStartDate
isn't passed from the props to the state so it doesn't work. A quick fix that makes it work may look like this: https://github.com/bright/CalendarPicker/commit/a4f6a8085a7f0c5f93e139e35185ea0c4f893404
Thanks @azabost for pointing that out. The state should also be updated on a prop change in componentDidUpdate
. Would be happy to review a PR that's been well tested.
@adityafuture01 @azabost
PR #123 passes selectedStartDate
to state and updates on prop change. Would you test if this is working correctly for you?
When a date or moment object passed to initialDate prop, calendar does not show the day in a month as selected though it does show the month and year represented by the passed date or moment object.
Please fix it.