Skip to content

Commit

Permalink
fix(kit): CalendarRange not switch to selected item (#8784)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohan-mu authored Sep 2, 2024
1 parent cc64434 commit ad138ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ad138ab

Please sign in to comment.