Skip to content

Commit

Permalink
fix(kit): fix defaultViewedMonth initialization in CalendarRange comp…
Browse files Browse the repository at this point in the history
…onent
  • Loading branch information
mohan-mu authored and splincode committed Sep 10, 2024
1 parent 7d84f9f commit 1ed2068
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1ed2068

Please sign in to comment.