Refactors calendar type to calendar mode

Updates the codebase to utilize `CalendarMode` instead of the deprecated `CalendarType`.

Simplifies `CalendarConfig` by removing legacy methods and related type aliases, enhancing code maintainability and clarity.

Improves event rendering by ensuring `GRID_RENDERED` events include explicit start and end dates, preventing errors and ensuring correct data filtering.
This commit is contained in:
Janus Knudsen 2025-08-20 21:51:49 +02:00
parent 83c0ce801c
commit 0ea4e47324
10 changed files with 61 additions and 91 deletions

View file

@ -90,17 +90,12 @@ export class EventRenderingService {
let periodEnd: Date;
if (startDate && endDate) {
// Legacy format with explicit dates
// Direct date format - use as provided
periodStart = startDate;
periodEnd = endDate;
} else if (currentDate) {
// New format - calculate period from current date
// For now, use a week period. This could be improved by getting the actual period from the strategy
const baseDate = new Date(currentDate);
periodStart = new Date(baseDate);
periodStart.setDate(baseDate.getDate() - baseDate.getDay() + 1); // Monday
periodEnd = new Date(periodStart);
periodEnd.setDate(periodStart.getDate() + 6); // Sunday
console.error('EventRenderer: GRID_RENDERED events must include explicit startDate and endDate', event.detail);
return;
} else {
console.error('EventRenderer: No date information in GRID_RENDERED event', event.detail);
return;