Refactors DateCalculator to be a static class
This change refactors the DateCalculator class to be a static class. This removes the need to instantiate DateCalculator in multiple managers and renderers, simplifying dependency management and ensuring consistent date calculations across the application. The configuration is now initialized once at the application start.
This commit is contained in:
parent
0da875a224
commit
b8b44ddae8
11 changed files with 107 additions and 83 deletions
|
|
@ -41,7 +41,8 @@ export class CalendarManager {
|
|||
this.eventRenderer = eventRenderer;
|
||||
this.scrollManager = scrollManager;
|
||||
this.eventFilterManager = new EventFilterManager();
|
||||
this.dateCalculator = new DateCalculator(config);
|
||||
DateCalculator.initialize(config);
|
||||
this.dateCalculator = new DateCalculator();
|
||||
this.setupEventListeners();
|
||||
}
|
||||
|
||||
|
|
@ -434,10 +435,10 @@ export class CalendarManager {
|
|||
const lastDate = new Date(lastDateStr);
|
||||
|
||||
// Calculate week number from first date
|
||||
const weekNumber = this.dateCalculator.getWeekNumber(firstDate);
|
||||
const weekNumber = DateCalculator.getWeekNumber(firstDate);
|
||||
|
||||
// Format date range
|
||||
const dateRange = this.dateCalculator.formatDateRange(firstDate, lastDate);
|
||||
const dateRange = DateCalculator.formatDateRange(firstDate, lastDate);
|
||||
|
||||
// Emit week info update
|
||||
this.eventBus.emit(CoreEvents.WEEK_CHANGED, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue