Skip to content

Commit

Permalink
fix(datepicker): quick ranges button is not selected with maxDate (#6670
Browse files Browse the repository at this point in the history
)
  • Loading branch information
daniloff200 committed Oct 22, 2024
1 parent 4741422 commit 94bf7bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/datepicker/themes/bs/bs-custom-dates-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ export interface BsCustomDates {
type="button"
class="btn"
(click)="selectFromRanges(range)"
[class.selected]="range.value === selectedRange">
[class.selected]="compareRanges(range)">
{{ range.label }}
</button>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand All @@ -32,4 +33,8 @@ export class BsCustomDatesViewComponent {
selectFromRanges(range?: BsCustomDates) {
this.onSelect.emit(range);
}

compareRanges(range?: BsCustomDates) {
return JSON.stringify(range?.value) === JSON.stringify(this.selectedRange);
}
}

0 comments on commit 94bf7bd

Please sign in to comment.