From a6f5d13df59d0988f7b7b8947521d03faabec619 Mon Sep 17 00:00:00 2001 From: Dmytro Danylov Date: Mon, 28 Oct 2024 10:57:48 +0200 Subject: [PATCH] fix(datepicker): quick ranges button is not selected with maxDate (#6670) (#6696) --- src/datepicker/themes/bs/bs-custom-dates-view.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/datepicker/themes/bs/bs-custom-dates-view.component.ts b/src/datepicker/themes/bs/bs-custom-dates-view.component.ts index 9bc17f543b..533bb4a55b 100644 --- a/src/datepicker/themes/bs/bs-custom-dates-view.component.ts +++ b/src/datepicker/themes/bs/bs-custom-dates-view.component.ts @@ -14,7 +14,7 @@ export interface BsCustomDates { type="button" class="btn" (click)="selectFromRanges(range)" - [class.selected]="range.value === selectedRange"> + [class.selected]="compareRanges(range)"> {{ range.label }} @@ -32,4 +32,8 @@ export class BsCustomDatesViewComponent { selectFromRanges(range?: BsCustomDates) { this.onSelect.emit(range); } + + compareRanges(range?: BsCustomDates) { + return JSON.stringify(range?.value) === JSON.stringify(this.selectedRange); + } }