Calendar/wwwroot/js/utils/TimeFormatter.d.ts
2026-02-03 00:02:25 +01:00

45 lines
1.6 KiB
TypeScript

/**
* TimeFormatter - Centralized time formatting with timezone support
* Now uses DateService internally for all date/time operations
*
* Handles conversion from UTC/Zulu time to configured timezone (default: Europe/Copenhagen)
* Supports both 12-hour and 24-hour format configuration
*
* All events in the system are stored in UTC and must be converted to local timezone
*/
import { ITimeFormatConfig } from '../configurations/TimeFormatConfig';
export declare class TimeFormatter {
private static settings;
private static dateService;
private static getDateService;
/**
* Configure time formatting settings
* Must be called before using TimeFormatter
*/
static configure(settings: ITimeFormatConfig): void;
/**
* Convert UTC date to configured timezone (internal helper)
* @param utcDate - Date in UTC (or ISO string)
* @returns Date object adjusted to configured timezone
*/
private static convertToLocalTime;
/**
* Format time in 24-hour format using DateService (internal helper)
* @param date - Date to format
* @returns Formatted time string (e.g., "09:00")
*/
private static format24Hour;
/**
* Format time according to current configuration
* @param date - Date to format
* @returns Formatted time string
*/
static formatTime(date: Date): string;
/**
* Format time range (start - end) using DateService
* @param startDate - Start date
* @param endDate - End date
* @returns Formatted time range string (e.g., "09:00 - 10:30")
*/
static formatTimeRange(startDate: Date, endDate: Date): string;
}