From 1ed2068eda7aa36932202859a1bdf1a476bf80c3 Mon Sep 17 00:00:00 2001 From: Mohan MU Date: Mon, 9 Sep 2024 21:27:21 +0530 Subject: [PATCH] fix(kit): fix defaultViewedMonth initialization in CalendarRange component --- .../components/calendar-range/calendar-range.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/kit/components/calendar-range/calendar-range.component.ts b/projects/kit/components/calendar-range/calendar-range.component.ts index 6efc986411fc..e251c181bddd 100644 --- a/projects/kit/components/calendar-range/calendar-range.component.ts +++ b/projects/kit/components/calendar-range/calendar-range.component.ts @@ -96,7 +96,7 @@ export class TuiCalendarRange implements OnInit, OnChanges { ?.pipe(tuiWatch(inject(ChangeDetectorRef)), takeUntilDestroyed()) .subscribe((value) => { this.value = value; - this.defaultViewedMonth = this.value?.to ?? this.defaultViewedMonth; + this.initDefaultViewedMonth(); }); } @@ -179,12 +179,13 @@ export class TuiCalendarRange implements OnInit, OnChanges { this.selectedActivePeriod = item; this.updateValue(item.range.dayLimit(this.min, this.max)); this.itemChange.emit(item); - this.defaultViewedMonth = this.value?.to ?? this.defaultViewedMonth; } else if (this.activePeriod !== null) { this.selectedActivePeriod = null; this.updateValue(null); this.itemChange.emit(null); } + + this.initDefaultViewedMonth(); } protected onMonthChange(month: TuiMonth): void {