Closed maniac-tech closed 4 years ago
initialDate
sets the month that the calendar opens to. selectedStartDate
is the prop that marks a date as selected.
The prop dateChanged
in your code snippet isn't supported. You may have meant to use onDateChange
.
selectedStartDate
My intention here is to load the Calendar component with a provided date.
As per what you pointed, is this the right approach:
<CalendarComponent selectedStartDate={initalDate} onDateChange={this.dateChanged}/>
?
@peacechen The issue hasn't been resolved yet, your suggested way isn't working as expected.
Can you attach a small Code snippet?
Could you clarify your requirements? If it's difficult to describe, an image mockup may help.
Could you clarify your requirements? If it's difficult to describe, an image mockup may help.
I want the Calendar to open with a default date of Today
Your code snippet should work:
<CalendarPicker
selectedStartDate={moment()}
onDateChange={this.dateChanged}
/>
The default month that it opens to is the initialDate prop, which is "today". selectedStartDate
marks the date as selected.
The initialDate prop of the CalendarComponent isn't populating the initial date being passed.
My Code snippet:
<CalendarComponent initialDate={new Date(2020, 6, 13)} dateChanged={this.dateChanged}/>