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:
parent
2d8577d539
commit
b5dfd57d9e
14 changed files with 1103 additions and 157 deletions
58
test/helpers/config-helpers.ts
Normal file
58
test/helpers/config-helpers.ts
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Test helpers for creating mock Configuration objects
|
||||
*/
|
||||
|
||||
import { Configuration } from '../../src/configurations/CalendarConfig';
|
||||
import { ICalendarConfig } from '../../src/configurations/ICalendarConfig';
|
||||
import { IGridSettings } from '../../src/configurations/GridSettings';
|
||||
import { IDateViewSettings } from '../../src/configurations/DateViewSettings';
|
||||
import { ITimeFormatConfig } from '../../src/configurations/TimeFormatConfig';
|
||||
|
||||
/**
|
||||
* Create a minimal test configuration with default values
|
||||
*/
|
||||
export function createTestConfig(overrides: Partial<{
|
||||
timezone: string;
|
||||
hourHeight: number;
|
||||
snapInterval: number;
|
||||
}> = {}): Configuration {
|
||||
const gridSettings: IGridSettings = {
|
||||
hourHeight: overrides.hourHeight ?? 60,
|
||||
gridStartTime: '00:00',
|
||||
gridEndTime: '24:00',
|
||||
workStartTime: '08:00',
|
||||
workEndTime: '17:00',
|
||||
snapInterval: overrides.snapInterval ?? 15,
|
||||
gridStartThresholdMinutes: 15
|
||||
};
|
||||
|
||||
const dateViewSettings: IDateViewSettings = {
|
||||
periodType: 'week',
|
||||
firstDayOfWeek: 1
|
||||
};
|
||||
|
||||
const timeFormatConfig: ITimeFormatConfig = {
|
||||
timezone: overrides.timezone ?? 'Europe/Copenhagen',
|
||||
locale: 'da-DK',
|
||||
showSeconds: false
|
||||
};
|
||||
|
||||
const calendarConfig: ICalendarConfig = {
|
||||
gridSettings,
|
||||
dateViewSettings,
|
||||
timeFormatConfig,
|
||||
currentWorkWeek: 'standard',
|
||||
currentView: 'week',
|
||||
selectedDate: new Date().toISOString()
|
||||
};
|
||||
|
||||
return new Configuration(
|
||||
calendarConfig,
|
||||
gridSettings,
|
||||
dateViewSettings,
|
||||
timeFormatConfig,
|
||||
'standard',
|
||||
'week',
|
||||
new Date()
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue