From 7c596501197f560bcebfe563279f824e3a45fb6a Mon Sep 17 00:00:00 2001 From: mertsincan Date: Thu, 15 Jul 2021 01:05:07 +0300 Subject: [PATCH] Fixed #2174 --- src/components/calendar/Calendar.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/calendar/Calendar.js b/src/components/calendar/Calendar.js index 5b8426e511..a1db6c1915 100644 --- a/src/components/calendar/Calendar.js +++ b/src/components/calendar/Calendar.js @@ -2604,23 +2604,23 @@ export class Calendar extends Component { if (this.props.monthNavigator && this.props.view !== 'month') { const viewDate = this.getViewDate(); const viewMonth = viewDate.getMonth(); - const displayedMonthNames = monthNames.filter((month, index) => (!this.isInMinYear(viewDate) || index >= this.props.minDate.getMonth()) && (!this.isInMaxYear(viewDate) || index <= this.props.maxDate.getMonth())); + const displayedMonthOptions = monthNames.map((month, index) => ((!this.isInMinYear(viewDate) || index >= this.props.minDate.getMonth()) && (!this.isInMaxYear(viewDate) || index <= this.props.maxDate.getMonth())) ? { label: month, value: index, index } : null).filter(option => !!option); + const displayedMonthNames = displayedMonthOptions.map(option => option.label); const content = ( ); if (this.props.monthNavigatorTemplate) { - const options = displayedMonthNames.map((name, i) => ({ label: name, value: i, index: i })); const defaultContentOptions = { onChange: this.onMonthDropdownChange, className: 'p-datepicker-month', value: viewMonth, names: displayedMonthNames, - options, + options: displayedMonthOptions, element: content, props: this.props };