Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekLiang committed Nov 2, 2024
1 parent e357cde commit 3183153
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/datepicker/themes/bs/bs-custom-dates-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ export class BsCustomDatesViewComponent {

compareRanges(range?: BsCustomDates) {
const currentRange = range?.value;
if (Array.isArray(currentRange) && Array.isArray(this.selectedRange)) {
return new Date(currentRange[0]).setHours(0, 0, 0, 0) === new Date(this.selectedRange[0]).setHours(0, 0, 0, 0)
&& new Date(currentRange[1]).setHours(0, 0, 0, 0) === new Date(this.selectedRange[1]).setHours(0, 0, 0, 0);
const selectedRange = this.selectedRange;
if (Array.isArray(currentRange) && Array.isArray(selectedRange)) {
return new Date(currentRange[0]).setHours(0, 0, 0, 0) === new Date(selectedRange[0]).setHours(0, 0, 0, 0)
&& new Date(currentRange[1]).setHours(0, 0, 0, 0) === new Date(selectedRange[1]).setHours(0, 0, 0, 0);
}

return JSON.stringify(range?.value) === JSON.stringify(this.selectedRange);
return JSON.stringify(currentRange) === JSON.stringify(selectedRange);
}
}

0 comments on commit 3183153

Please sign in to comment.