Adds technical date and time formatting

Adds options for technical date and time formatting and includes the option to show seconds.

Updates time formatting to use UTC-to-local conversion and ensures consistent colon separators for time values.

Adjusts all-day event handling to preserve original start/end times.
This commit is contained in:
Janus C. H. Knudsen 2025-10-03 16:05:22 +02:00
parent c8d78f472d
commit 38737762c5
7 changed files with 370 additions and 26 deletions

View file

@ -78,6 +78,8 @@ interface TimeFormatConfig {
timezone: string;
use24HourFormat: boolean;
locale: string;
dateFormat: 'locale' | 'technical';
showSeconds: boolean;
}
/**
@ -154,11 +156,13 @@ export class CalendarConfig {
showAllDay: true
};
// Time format settings - default to Denmark
// Time format settings - default to Denmark with technical format
this.timeFormatConfig = {
timezone: 'Europe/Copenhagen',
use24HourFormat: true,
locale: 'da-DK'
locale: 'da-DK',
dateFormat: 'technical',
showSeconds: false
};
// Set computed values
@ -545,6 +549,27 @@ export class CalendarConfig {
return this.timeFormatConfig.use24HourFormat;
}
/**
* Set date format (convenience method)
*/
setDateFormat(format: 'locale' | 'technical'): void {
this.updateTimeFormatSettings({ dateFormat: format });
}
/**
* Set whether to show seconds (convenience method)
*/
setShowSeconds(show: boolean): void {
this.updateTimeFormatSettings({ showSeconds: show });
}
/**
* Get current date format
*/
getDateFormat(): 'locale' | 'technical' {
return this.timeFormatConfig.dateFormat;
}
}
// Create singleton instance