From faea543a7cef24999d76082dc30dd3d302cc21f2 Mon Sep 17 00:00:00 2001 From: Dmytro Danylov Date: Tue, 22 Oct 2024 11:15:26 +0300 Subject: [PATCH] fix(datepicker): quick ranges button is not selected with maxDate (#6670) --- 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); + } }