@@ -16,7 +16,7 @@ import { filter, takeUntil } from 'rxjs/operators';
16
16
import { CalendarSelection , IgxCalendarComponent , IgxCalendarHeaderTemplateDirective , IgxCalendarHeaderTitleTemplateDirective , IgxCalendarSubheaderTemplateDirective } from '../calendar/public_api' ;
17
17
import { DateRangeType } from '../core/dates' ;
18
18
import { DateRangePickerResourceStringsEN , IDateRangePickerResourceStrings } from '../core/i18n/date-range-picker-resources' ;
19
- import { IBaseCancelableBrowserEventArgs , isDate , parseDate , PlatformUtil } from '../core/utils' ;
19
+ import { clamp , IBaseCancelableBrowserEventArgs , isDate , parseDate , PlatformUtil } from '../core/utils' ;
20
20
import { IgxCalendarContainerComponent } from '../date-common/calendar-container/calendar-container.component' ;
21
21
import { PickerBaseDirective } from '../date-common/picker-base.directive' ;
22
22
import { IgxPickerActionsDirective } from '../date-common/picker-icons.common' ;
@@ -92,7 +92,13 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
92
92
* ```
93
93
*/
94
94
@Input ( )
95
- public displayMonthsCount = 2 ;
95
+ public get displayMonthsCount ( ) : number {
96
+ return this . _displayMonthsCount ;
97
+ }
98
+
99
+ public set displayMonthsCount ( value : number ) {
100
+ this . _displayMonthsCount = clamp ( value , 1 , 2 ) ;
101
+ }
96
102
97
103
/**
98
104
* Gets/Sets the orientation of the multiple months displayed in the picker's calendar's days view.
@@ -468,6 +474,7 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
468
474
private _calendarContainer ?: HTMLElement ;
469
475
private _positionSettings : PositionSettings ;
470
476
private _focusedInput : IgxDateRangeInputsBaseComponent ;
477
+ private _displayMonthsCount = 2 ;
471
478
private _overlaySubFilter :
472
479
[ MonoTypeOperatorFunction < OverlayEventArgs > , MonoTypeOperatorFunction < OverlayEventArgs | OverlayCancelableEventArgs > ] = [
473
480
filter ( x => x . id === this . _overlayId ) ,
@@ -1105,7 +1112,7 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
1105
1112
this . calendar . selection = CalendarSelection . RANGE ;
1106
1113
this . calendar . weekStart = this . weekStart ;
1107
1114
this . calendar . hideOutsideDays = this . hideOutsideDays ;
1108
- this . calendar . monthsViewNumber = this . displayMonthsCount ;
1115
+ this . calendar . monthsViewNumber = this . _displayMonthsCount ;
1109
1116
this . calendar . showWeekNumbers = this . showWeekNumbers ;
1110
1117
this . _calendar . headerTitleTemplate = this . headerTitleTemplate ;
1111
1118
this . _calendar . headerTemplate = this . headerTemplate ;
0 commit comments