diff --git a/projects/kit/components/calendar-range/calendar-range.component.ts b/projects/kit/components/calendar-range/calendar-range.component.ts index 757c6eb3f9f5..478aefabdcd6 100644 --- a/projects/kit/components/calendar-range/calendar-range.component.ts +++ b/projects/kit/components/calendar-range/calendar-range.component.ts @@ -113,6 +113,10 @@ export class TuiCalendarRange implements OnInit, OnChanges { this.selectedPeriod = period; } + public get computedMonth(): TuiMonth { + return this.value ? this.value.from : this.defaultViewedMonth; + } + public ngOnChanges(): void { this.defaultViewedMonth = (this.items.length ? this.value?.to : this.value?.from) || diff --git a/projects/kit/components/calendar-range/calendar-range.template.html b/projects/kit/components/calendar-range/calendar-range.template.html index c82016a1535c..5d2f1b9a8a84 100644 --- a/projects/kit/components/calendar-range/calendar-range.template.html +++ b/projects/kit/components/calendar-range/calendar-range.template.html @@ -6,7 +6,7 @@ [max]="max | tuiMapper: capsMapper : value : maxLength : false" [maxViewedMonth]="items.length ? null : (defaultViewedMonth | tuiMapper: monthOffset : -1)" [min]="min | tuiMapper: capsMapper : value : maxLength : true" - [month]="defaultViewedMonth" + [month]="computedMonth" [showAdjacent]="!!items.length" [value]="value" [(hoveredItem)]="hoveredItem"