Migrates date handling from date-fns to day.js

Replaces date-fns library with day.js to reduce bundle size and improve tree-shaking

- Centralizes all date logic in DateService
- Reduces library footprint from 576 KB to 29 KB
- Maintains 99.4% test coverage during migration
- Adds timezone and formatting plugins for day.js

Improves overall library performance and reduces dependency complexity
This commit is contained in:
Janus C. H. Knudsen 2025-11-12 23:51:48 +01:00
parent 2d8577d539
commit b5dfd57d9e
14 changed files with 1103 additions and 157 deletions

View file

@ -16,20 +16,20 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { EventStackManager } from '../../src/managers/EventStackManager';
import { EventLayoutCoordinator } from '../../src/managers/EventLayoutCoordinator';
import { CalendarConfig } from '../../src/core/CalendarConfig';
import { createTestConfig } from '../helpers/config-helpers';
import { PositionUtils } from '../../src/utils/PositionUtils';
import { DateService } from '../../src/utils/DateService';
describe('EventStackManager - Flexbox & Nested Stacking (3-Phase Algorithm)', () => {
let manager: EventStackManager;
let thresholdMinutes: number;
let config: CalendarConfig;
let config: ReturnType<typeof createTestConfig>;
beforeEach(() => {
config = new CalendarConfig();
config = createTestConfig();
manager = new EventStackManager(config);
// Get threshold from config - tests should work with any value
thresholdMinutes = config.getGridSettings().gridStartThresholdMinutes;
thresholdMinutes = config.gridSettings.gridStartThresholdMinutes;
});
// ============================================

View file

@ -3,7 +3,7 @@ import { NavigationManager } from '../../src/managers/NavigationManager';
import { EventBus } from '../../src/core/EventBus';
import { EventRenderingService } from '../../src/renderers/EventRendererManager';
import { DateService } from '../../src/utils/DateService';
import { CalendarConfig } from '../../src/core/CalendarConfig';
import { createTestConfig } from '../helpers/config-helpers';
describe('NavigationManager - Edge Cases', () => {
let navigationManager: NavigationManager;
@ -12,7 +12,7 @@ describe('NavigationManager - Edge Cases', () => {
beforeEach(() => {
eventBus = new EventBus();
const config = new CalendarConfig();
const config = createTestConfig();
dateService = new DateService(config);
const mockEventRenderer = {} as EventRenderingService;
const mockGridRenderer = {} as any;