2025-07-24 22:17:38 +02:00
|
|
|
import { EventBus } from '../core/EventBus.js';
|
2025-08-20 20:22:51 +02:00
|
|
|
import { CoreEvents } from '../constants/CoreEvents.js';
|
2025-07-24 22:17:38 +02:00
|
|
|
import { CalendarConfig } from '../core/CalendarConfig.js';
|
|
|
|
|
import { CalendarEvent, CalendarView, IEventBus } from '../types/CalendarTypes.js';
|
2025-08-09 01:16:04 +02:00
|
|
|
import { EventManager } from './EventManager.js';
|
|
|
|
|
import { GridManager } from './GridManager.js';
|
2025-08-17 23:44:30 +02:00
|
|
|
import { EventRenderingService } from '../renderers/EventRendererManager.js';
|
2025-08-09 01:16:04 +02:00
|
|
|
import { ScrollManager } from './ScrollManager.js';
|
2025-08-18 23:42:03 +02:00
|
|
|
import { DateCalculator } from '../utils/DateCalculator.js';
|
2025-08-23 00:01:59 +02:00
|
|
|
import { EventFilterManager } from './EventFilterManager.js';
|
2025-07-24 22:17:38 +02:00
|
|
|
|
|
|
|
|
/**
|
2025-08-09 00:31:44 +02:00
|
|
|
* CalendarManager - Main coordinator for all calendar managers
|
2025-08-09 01:16:04 +02:00
|
|
|
* Uses simple direct method calls instead of complex state management
|
2025-07-24 22:17:38 +02:00
|
|
|
*/
|
|
|
|
|
export class CalendarManager {
|
|
|
|
|
private eventBus: IEventBus;
|
|
|
|
|
private config: CalendarConfig;
|
2025-08-09 01:16:04 +02:00
|
|
|
private eventManager: EventManager;
|
|
|
|
|
private gridManager: GridManager;
|
2025-08-17 23:44:30 +02:00
|
|
|
private eventRenderer: EventRenderingService;
|
2025-08-09 01:16:04 +02:00
|
|
|
private scrollManager: ScrollManager;
|
2025-08-23 00:01:59 +02:00
|
|
|
private eventFilterManager: EventFilterManager;
|
2025-08-18 23:42:03 +02:00
|
|
|
private dateCalculator: DateCalculator;
|
2025-07-24 22:17:38 +02:00
|
|
|
private currentView: CalendarView = 'week';
|
|
|
|
|
private currentDate: Date = new Date();
|
|
|
|
|
private isInitialized: boolean = false;
|
|
|
|
|
|
2025-08-17 23:44:30 +02:00
|
|
|
constructor(
|
|
|
|
|
eventBus: IEventBus,
|
|
|
|
|
config: CalendarConfig,
|
|
|
|
|
eventManager: EventManager,
|
|
|
|
|
gridManager: GridManager,
|
|
|
|
|
eventRenderer: EventRenderingService,
|
|
|
|
|
scrollManager: ScrollManager
|
|
|
|
|
) {
|
2025-07-24 22:17:38 +02:00
|
|
|
this.eventBus = eventBus;
|
|
|
|
|
this.config = config;
|
2025-08-09 01:16:04 +02:00
|
|
|
this.eventManager = eventManager;
|
|
|
|
|
this.gridManager = gridManager;
|
|
|
|
|
this.eventRenderer = eventRenderer;
|
|
|
|
|
this.scrollManager = scrollManager;
|
2025-08-23 00:01:59 +02:00
|
|
|
this.eventFilterManager = new EventFilterManager();
|
2025-08-18 23:42:03 +02:00
|
|
|
this.dateCalculator = new DateCalculator(config);
|
2025-08-17 23:44:30 +02:00
|
|
|
this.setupEventListeners();
|
2025-08-09 01:16:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize calendar system using simple direct calls
|
2025-07-24 22:17:38 +02:00
|
|
|
*/
|
2025-08-09 00:31:44 +02:00
|
|
|
public async initialize(): Promise<void> {
|
2025-07-24 22:17:38 +02:00
|
|
|
if (this.isInitialized) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-08-09 00:31:44 +02:00
|
|
|
try {
|
2025-08-10 23:06:03 +02:00
|
|
|
// Debug: Check calendar type
|
|
|
|
|
const calendarType = this.config.getCalendarMode();
|
|
|
|
|
|
2025-08-09 01:16:04 +02:00
|
|
|
// Step 1: Load data
|
|
|
|
|
await this.eventManager.loadData();
|
2025-08-09 00:31:44 +02:00
|
|
|
|
2025-08-10 23:06:03 +02:00
|
|
|
// Step 2: Pass data to GridManager and render grid structure
|
|
|
|
|
if (calendarType === 'resource') {
|
|
|
|
|
const resourceData = this.eventManager.getResourceData();
|
|
|
|
|
this.gridManager.setResourceData(resourceData);
|
|
|
|
|
}
|
2025-08-09 01:16:04 +02:00
|
|
|
await this.gridManager.render();
|
|
|
|
|
|
2025-08-24 00:13:07 +02:00
|
|
|
// Step 2b: Trigger event rendering now that data is loaded
|
|
|
|
|
// Re-emit GRID_RENDERED to trigger EventRendererManager
|
|
|
|
|
const gridContainer = document.querySelector('swp-calendar-container');
|
|
|
|
|
if (gridContainer) {
|
|
|
|
|
const periodRange = this.gridManager.getDisplayDates();
|
|
|
|
|
this.eventBus.emit(CoreEvents.GRID_RENDERED, {
|
|
|
|
|
container: gridContainer,
|
|
|
|
|
currentDate: new Date(),
|
|
|
|
|
startDate: periodRange[0],
|
|
|
|
|
endDate: periodRange[periodRange.length - 1],
|
|
|
|
|
columnCount: periodRange.length
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-09 01:16:04 +02:00
|
|
|
// Step 3: Initialize scroll synchronization
|
|
|
|
|
this.scrollManager.initialize();
|
|
|
|
|
|
|
|
|
|
// Step 4: Set initial view and date BEFORE event rendering
|
2025-08-09 00:31:44 +02:00
|
|
|
this.setView(this.currentView);
|
|
|
|
|
this.setCurrentDate(this.currentDate);
|
|
|
|
|
|
2025-08-16 00:51:12 +02:00
|
|
|
// Step 5: Event rendering will be triggered by GRID_RENDERED event
|
2025-08-09 01:16:04 +02:00
|
|
|
|
2025-08-09 00:31:44 +02:00
|
|
|
this.isInitialized = true;
|
|
|
|
|
|
2025-08-16 00:51:12 +02:00
|
|
|
// Emit initialization complete event
|
2025-08-20 20:22:51 +02:00
|
|
|
this.eventBus.emit(CoreEvents.INITIALIZED, {
|
2025-08-16 00:51:12 +02:00
|
|
|
currentDate: this.currentDate,
|
|
|
|
|
currentView: this.currentView
|
|
|
|
|
});
|
|
|
|
|
|
2025-08-09 00:31:44 +02:00
|
|
|
} catch (error) {
|
2025-08-09 01:16:04 +02:00
|
|
|
throw error;
|
2025-08-09 00:31:44 +02:00
|
|
|
}
|
2025-07-24 22:17:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Skift calendar view (dag/uge/måned)
|
|
|
|
|
*/
|
|
|
|
|
public setView(view: CalendarView): void {
|
|
|
|
|
if (this.currentView === view) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const previousView = this.currentView;
|
|
|
|
|
this.currentView = view;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Emit view change event
|
2025-08-20 20:22:51 +02:00
|
|
|
this.eventBus.emit(CoreEvents.VIEW_CHANGED, {
|
2025-07-24 22:17:38 +02:00
|
|
|
previousView,
|
|
|
|
|
currentView: view,
|
|
|
|
|
date: this.currentDate
|
|
|
|
|
});
|
2025-08-12 00:07:39 +02:00
|
|
|
|
2025-08-16 00:51:12 +02:00
|
|
|
// Grid re-rendering will trigger event rendering automatically via GRID_RENDERED event
|
2025-07-24 22:17:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sæt aktuel dato
|
|
|
|
|
*/
|
|
|
|
|
public setCurrentDate(date: Date): void {
|
2025-08-20 20:22:51 +02:00
|
|
|
// Validate input date
|
|
|
|
|
if (!date || !(date instanceof Date) || isNaN(date.getTime())) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-24 22:17:38 +02:00
|
|
|
const previousDate = this.currentDate;
|
|
|
|
|
this.currentDate = new Date(date);
|
|
|
|
|
|
2025-08-20 20:22:51 +02:00
|
|
|
// Validate that both dates are valid before logging
|
|
|
|
|
const prevDateStr = previousDate && !isNaN(previousDate.getTime()) ? previousDate.toISOString() : 'Invalid Date';
|
|
|
|
|
const newDateStr = this.currentDate.toISOString();
|
|
|
|
|
|
2025-07-24 22:17:38 +02:00
|
|
|
|
|
|
|
|
// Emit date change event
|
2025-08-20 20:22:51 +02:00
|
|
|
this.eventBus.emit(CoreEvents.DATE_CHANGED, {
|
2025-07-24 22:17:38 +02:00
|
|
|
previousDate,
|
|
|
|
|
currentDate: this.currentDate,
|
|
|
|
|
view: this.currentView
|
|
|
|
|
});
|
2025-08-12 00:07:39 +02:00
|
|
|
|
2025-08-16 00:51:12 +02:00
|
|
|
// Grid update for new date will trigger event rendering automatically via GRID_RENDERED event
|
2025-07-24 22:17:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Naviger til i dag
|
|
|
|
|
*/
|
|
|
|
|
public goToToday(): void {
|
|
|
|
|
this.setCurrentDate(new Date());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Naviger til næste periode (dag/uge/måned afhængig af view)
|
|
|
|
|
*/
|
|
|
|
|
public goToNext(): void {
|
|
|
|
|
const nextDate = this.calculateNextDate();
|
|
|
|
|
this.setCurrentDate(nextDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Naviger til forrige periode (dag/uge/måned afhængig af view)
|
|
|
|
|
*/
|
|
|
|
|
public goToPrevious(): void {
|
|
|
|
|
const previousDate = this.calculatePreviousDate();
|
|
|
|
|
this.setCurrentDate(previousDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hent aktuel view
|
|
|
|
|
*/
|
|
|
|
|
public getCurrentView(): CalendarView {
|
|
|
|
|
return this.currentView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hent aktuel dato
|
|
|
|
|
*/
|
|
|
|
|
public getCurrentDate(): Date {
|
|
|
|
|
return new Date(this.currentDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hent calendar konfiguration
|
|
|
|
|
*/
|
|
|
|
|
public getConfig(): CalendarConfig {
|
|
|
|
|
return this.config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check om calendar er initialiseret
|
|
|
|
|
*/
|
|
|
|
|
public isCalendarInitialized(): boolean {
|
2025-08-09 01:16:04 +02:00
|
|
|
return this.isInitialized;
|
2025-08-09 00:31:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get initialization report for debugging
|
|
|
|
|
*/
|
|
|
|
|
public getInitializationReport(): any {
|
2025-08-09 01:16:04 +02:00
|
|
|
return {
|
|
|
|
|
isInitialized: this.isInitialized,
|
|
|
|
|
currentView: this.currentView,
|
|
|
|
|
currentDate: this.currentDate,
|
|
|
|
|
initializationTime: 'N/A - simple initialization'
|
|
|
|
|
};
|
2025-07-24 22:17:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Genindlæs calendar data
|
|
|
|
|
*/
|
|
|
|
|
public refresh(): void {
|
|
|
|
|
|
2025-08-20 20:22:51 +02:00
|
|
|
this.eventBus.emit(CoreEvents.REFRESH_REQUESTED, {
|
2025-07-24 22:17:38 +02:00
|
|
|
view: this.currentView,
|
|
|
|
|
date: this.currentDate
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Ryd calendar og nulstil til standard tilstand
|
|
|
|
|
*/
|
|
|
|
|
public reset(): void {
|
|
|
|
|
|
|
|
|
|
this.currentView = 'week';
|
|
|
|
|
this.currentDate = new Date();
|
|
|
|
|
|
2025-08-20 20:22:51 +02:00
|
|
|
this.eventBus.emit(CoreEvents.REFRESH_REQUESTED, {
|
2025-07-24 22:17:38 +02:00
|
|
|
view: this.currentView,
|
|
|
|
|
date: this.currentDate
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Setup event listeners for at håndtere events fra andre managers
|
|
|
|
|
*/
|
|
|
|
|
private setupEventListeners(): void {
|
2025-08-20 20:22:51 +02:00
|
|
|
// Listen for workweek changes only
|
|
|
|
|
this.eventBus.on(CoreEvents.WORKWEEK_CHANGED, (event: Event) => {
|
2025-08-18 22:27:17 +02:00
|
|
|
const customEvent = event as CustomEvent;
|
|
|
|
|
this.handleWorkweekChange();
|
2025-08-18 23:24:22 +02:00
|
|
|
|
|
|
|
|
// Also update week info display since workweek affects date range display
|
|
|
|
|
this.updateWeekInfoForWorkweekChange();
|
2025-08-18 22:27:17 +02:00
|
|
|
});
|
2025-07-24 22:17:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Beregn næste dato baseret på aktuel view
|
|
|
|
|
*/
|
|
|
|
|
private calculateNextDate(): Date {
|
|
|
|
|
const nextDate = new Date(this.currentDate);
|
|
|
|
|
|
|
|
|
|
switch (this.currentView) {
|
|
|
|
|
case 'day':
|
|
|
|
|
nextDate.setDate(nextDate.getDate() + 1);
|
|
|
|
|
break;
|
|
|
|
|
case 'week':
|
2025-08-18 22:27:17 +02:00
|
|
|
const workWeekSettings = this.config.getWorkWeekSettings();
|
|
|
|
|
nextDate.setDate(nextDate.getDate() + 7); // Move to next calendar week regardless of work days
|
2025-07-24 22:17:38 +02:00
|
|
|
break;
|
|
|
|
|
case 'month':
|
|
|
|
|
nextDate.setMonth(nextDate.getMonth() + 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nextDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Beregn forrige dato baseret på aktuel view
|
|
|
|
|
*/
|
|
|
|
|
private calculatePreviousDate(): Date {
|
|
|
|
|
const previousDate = new Date(this.currentDate);
|
|
|
|
|
|
|
|
|
|
switch (this.currentView) {
|
|
|
|
|
case 'day':
|
|
|
|
|
previousDate.setDate(previousDate.getDate() - 1);
|
|
|
|
|
break;
|
|
|
|
|
case 'week':
|
2025-08-18 22:27:17 +02:00
|
|
|
const workWeekSettings = this.config.getWorkWeekSettings();
|
|
|
|
|
previousDate.setDate(previousDate.getDate() - 7); // Move to previous calendar week regardless of work days
|
2025-07-24 22:17:38 +02:00
|
|
|
break;
|
|
|
|
|
case 'month':
|
|
|
|
|
previousDate.setMonth(previousDate.getMonth() - 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return previousDate;
|
|
|
|
|
}
|
2025-08-12 00:07:39 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Calculate the current period based on view and date
|
|
|
|
|
*/
|
|
|
|
|
private calculateCurrentPeriod(): { start: string; end: string } {
|
|
|
|
|
const current = new Date(this.currentDate);
|
|
|
|
|
|
|
|
|
|
switch (this.currentView) {
|
|
|
|
|
case 'day':
|
|
|
|
|
const dayStart = new Date(current);
|
|
|
|
|
dayStart.setHours(0, 0, 0, 0);
|
|
|
|
|
const dayEnd = new Date(current);
|
|
|
|
|
dayEnd.setHours(23, 59, 59, 999);
|
|
|
|
|
return {
|
|
|
|
|
start: dayStart.toISOString(),
|
|
|
|
|
end: dayEnd.toISOString()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
case 'week':
|
|
|
|
|
// Find start of week (Monday)
|
|
|
|
|
const weekStart = new Date(current);
|
|
|
|
|
const dayOfWeek = weekStart.getDay();
|
|
|
|
|
const daysToMonday = dayOfWeek === 0 ? 6 : dayOfWeek - 1; // Sunday = 0, so 6 days back to Monday
|
|
|
|
|
weekStart.setDate(weekStart.getDate() - daysToMonday);
|
|
|
|
|
weekStart.setHours(0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
// Find end of week (Sunday)
|
|
|
|
|
const weekEnd = new Date(weekStart);
|
|
|
|
|
weekEnd.setDate(weekEnd.getDate() + 6);
|
|
|
|
|
weekEnd.setHours(23, 59, 59, 999);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
start: weekStart.toISOString(),
|
|
|
|
|
end: weekEnd.toISOString()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
case 'month':
|
|
|
|
|
const monthStart = new Date(current.getFullYear(), current.getMonth(), 1);
|
|
|
|
|
const monthEnd = new Date(current.getFullYear(), current.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
|
|
|
return {
|
|
|
|
|
start: monthStart.toISOString(),
|
|
|
|
|
end: monthEnd.toISOString()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
// Fallback to week view
|
|
|
|
|
const fallbackStart = new Date(current);
|
|
|
|
|
fallbackStart.setDate(fallbackStart.getDate() - 3);
|
|
|
|
|
fallbackStart.setHours(0, 0, 0, 0);
|
|
|
|
|
const fallbackEnd = new Date(current);
|
|
|
|
|
fallbackEnd.setDate(fallbackEnd.getDate() + 3);
|
|
|
|
|
fallbackEnd.setHours(23, 59, 59, 999);
|
|
|
|
|
return {
|
|
|
|
|
start: fallbackStart.toISOString(),
|
|
|
|
|
end: fallbackEnd.toISOString()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-18 22:27:17 +02:00
|
|
|
/**
|
|
|
|
|
* Handle workweek configuration changes
|
|
|
|
|
*/
|
|
|
|
|
private handleWorkweekChange(): void {
|
|
|
|
|
|
|
|
|
|
// Force a complete grid rebuild by clearing existing structure
|
|
|
|
|
const container = document.querySelector('swp-calendar-container');
|
|
|
|
|
if (container) {
|
|
|
|
|
container.innerHTML = ''; // Clear everything to force full rebuild
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Re-render the grid with new workweek settings (will now rebuild everything)
|
|
|
|
|
this.gridManager.render();
|
|
|
|
|
|
|
|
|
|
// Re-initialize scroll manager after grid rebuild
|
|
|
|
|
this.scrollManager.initialize();
|
|
|
|
|
|
|
|
|
|
// Re-render events in the new grid structure
|
|
|
|
|
this.rerenderEvents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Re-render events after grid structure changes
|
|
|
|
|
*/
|
|
|
|
|
private rerenderEvents(): void {
|
|
|
|
|
|
|
|
|
|
// Get current period data to determine date range
|
|
|
|
|
const periodData = this.calculateCurrentPeriod();
|
|
|
|
|
|
2025-08-18 23:24:22 +02:00
|
|
|
// Find the grid container to render events in
|
|
|
|
|
const container = document.querySelector('swp-calendar-container');
|
|
|
|
|
if (!container) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Trigger event rendering for the current date range using correct method
|
|
|
|
|
this.eventRenderer.renderEvents({
|
|
|
|
|
container: container as HTMLElement,
|
2025-08-18 23:42:03 +02:00
|
|
|
startDate: new Date(periodData.start),
|
|
|
|
|
endDate: new Date(periodData.end)
|
2025-08-18 23:24:22 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update week info display after workweek changes
|
|
|
|
|
*/
|
|
|
|
|
private updateWeekInfoForWorkweekChange(): void {
|
|
|
|
|
// Don't do anything here - let GRID_RENDERED event handle it
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update week info based on actual rendered columns
|
|
|
|
|
*/
|
|
|
|
|
private updateWeekInfoFromRenderedColumns(): void {
|
|
|
|
|
|
|
|
|
|
// Get actual dates from rendered columns
|
|
|
|
|
const columns = document.querySelectorAll('swp-day-column');
|
|
|
|
|
if (columns.length === 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get first and last column dates
|
|
|
|
|
const firstColumn = columns[0] as HTMLElement;
|
|
|
|
|
const lastColumn = columns[columns.length - 1] as HTMLElement;
|
|
|
|
|
|
|
|
|
|
const firstDateStr = firstColumn.dataset.date;
|
|
|
|
|
const lastDateStr = lastColumn.dataset.date;
|
|
|
|
|
|
|
|
|
|
if (!firstDateStr || !lastDateStr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse dates
|
|
|
|
|
const firstDate = new Date(firstDateStr);
|
|
|
|
|
const lastDate = new Date(lastDateStr);
|
|
|
|
|
|
|
|
|
|
// Calculate week number from first date
|
2025-08-18 23:42:03 +02:00
|
|
|
const weekNumber = this.dateCalculator.getWeekNumber(firstDate);
|
2025-08-18 23:24:22 +02:00
|
|
|
|
|
|
|
|
// Format date range
|
2025-08-18 23:42:03 +02:00
|
|
|
const dateRange = this.dateCalculator.formatDateRange(firstDate, lastDate);
|
2025-08-18 23:24:22 +02:00
|
|
|
|
|
|
|
|
// Emit week info update
|
2025-08-20 20:22:51 +02:00
|
|
|
this.eventBus.emit(CoreEvents.WEEK_CHANGED, {
|
2025-08-18 23:24:22 +02:00
|
|
|
weekNumber,
|
|
|
|
|
dateRange,
|
|
|
|
|
weekStart: firstDate,
|
|
|
|
|
weekEnd: lastDate
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-18 22:27:17 +02:00
|
|
|
|
2025-07-24 22:17:38 +02:00
|
|
|
}
|