Is there any way to auto close picker after selecting year or month? I am using 'decade' view and 'year' view to only select Year or Month from picker. And after selcting it picker should close as per my requirement.
Ex. Currenlty i am selecting an year and closing it manually. Then again if i want to change year then it is going into months sections of previosuly selected year. I want to prevent that.
Here is for Year View.
<DatePicker
value={this.state.selectedYear}
onClickYear = {(value) => this.setState({ selectedYear: value })}
view="decade"
/>
Here is for Month View
<DatePicker
value={this.state.selectedMonth}
onClickMonth = {(value) => this.setState({ selectedMonth: value })}
view="year"
/>
You could use maxDetail="year" to keep the user from entering the month view. This way you will only select a month, not a specific day in it.
Thanks. I found this property in documentation after your comment. I think sometimes it is difficult to understand explanation as per requirement even if what we are looking for is right there.
Most helpful comment
You could use
maxDetail="year"to keep the user from entering the month view. This way you will only select a month, not a specific day in it.