From cee67ce3df0883e4424d8bca3a42ed2494348cb8 Mon Sep 17 00:00:00 2001 From: Nessar Date: Sat, 17 Oct 2026 11:36:19 +0200 Subject: [PATCH] refactor(calendar): drop the unused projection horizon No caller read CalendarProjection.horizon, and with fixed months it no longer described the listed months. Refs #276 Co-Authored-By: Claude Opus 5.5 --- .../components/calendar-year/calendar-year-planning.spec.ts | 6 +----- src/app/services/calendar-service.spec.ts | 4 +++- src/app/services/calendar-service.ts | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/components/calendar-year/calendar-year-planning.spec.ts b/src/app/components/calendar-year/calendar-year-planning.spec.ts index 3602085..9e4d5fe 100644 --- a/src/app/components/calendar-year/calendar-year-planning.spec.ts +++ b/src/app/components/calendar-year/calendar-year-planning.spec.ts @@ -142,11 +142,7 @@ function projectionFor( months.push({ monthIndex: cursor.getMonth(), year: cursor.getFullYear() }); cursor.setMonth(cursor.getMonth() + 1); } - return { - horizon, - months, - selections: selectedDatesForPlan(value, includeHoliday), - }; + return { months, selections: selectedDatesForPlan(value, includeHoliday) }; } function selectedDatesForPlan( diff --git a/src/app/services/calendar-service.spec.ts b/src/app/services/calendar-service.spec.ts index 51a34a3..ec749a9 100644 --- a/src/app/services/calendar-service.spec.ts +++ b/src/app/services/calendar-service.spec.ts @@ -277,7 +277,9 @@ describe('CalendarService', () => { typeof value === 'object' && value ? Object.freeze(value) : value, ); const projection = service.project(frozen); - expect(projection.horizon.end).toBe('2024-04-04'); + expect(projection.selections.dayTypes(new Date('2024-04-03T00:00:00'))).toContain( + DayType.RTT, + ); expect(frozen).toEqual(before); }); }); diff --git a/src/app/services/calendar-service.ts b/src/app/services/calendar-service.ts index 0ea9091..bedccdc 100644 --- a/src/app/services/calendar-service.ts +++ b/src/app/services/calendar-service.ts @@ -53,7 +53,6 @@ export function calendarProjectionHorizon(plan: CalendarPlan) { } export interface CalendarProjection { - horizon: { start: string; end: string }; months: { monthIndex: number; year: number }[]; selections: SelectedDates; } @@ -147,7 +146,7 @@ export class CalendarService { ), ); } - return { horizon, months, selections: new SelectedDates(ranges) }; + return { months, selections: new SelectedDates(ranges) }; } getHolidays(startYear = this.dateCache.getCurrentYear(), lastYear = startYear + 1): Date[] {