Skip to content

Commit

Permalink
fix: review 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB committed Sep 9, 2024
1 parent 1e6abaa commit 737e08e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/elements/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class SbbCalendarElement<T = Date> extends SbbHydrationMixin(LitElement)
if (
!!this._selectedDate &&
(!this._isDayInRange(this._dateAdapter.toIso8601(this._selectedDate)) ||
this._dateFilter()(this._selectedDate))
this._dateFilter(this._selectedDate))
) {
this._selected = this._dateAdapter.toIso8601(this._selectedDate);
} else {
Expand Down Expand Up @@ -235,8 +235,8 @@ export class SbbCalendarElement<T = Date> extends SbbHydrationMixin(LitElement)
this._setWeekdays();
}

private _dateFilter(): (date: T) => boolean {
return this.dateFilter ?? (() => true);
private _dateFilter(date: T): boolean {
return this.dateFilter?.(date) ?? true;
}

/** Resets the active month according to the new state of the calendar. */
Expand Down Expand Up @@ -966,7 +966,7 @@ export class SbbCalendarElement<T = Date> extends SbbHydrationMixin(LitElement)
private _createDayCells(week: Day[], today: string): TemplateResult[] {
return week.map((day: Day) => {
const isOutOfRange = !this._isDayInRange(day.value);
const isFilteredOut = !this._dateFilter()(this._dateAdapter.deserialize(day.value)!);
const isFilteredOut = !this._dateFilter(this._dateAdapter.deserialize(day.value)!);
const selected: boolean = !!this._selected && day.value === this._selected;
const dayValue = `${day.dayValue} ${day.monthValue} ${day.yearValue}`;
const isToday = day.value === today;
Expand Down

0 comments on commit 737e08e

Please sign in to comment.