ts-type-forge
    Preparing search index...

    Type Alias HoursEnum

    HoursEnum: Index<24>

    Represents the hours in a day using 24-hour format. A union of integer literals from 0 (midnight) to 23 (11 PM).

    Uses the international standard 24-hour time format where:

    • 0 represents midnight (00:00)
    • 12 represents noon (12:00)
    • 23 represents 11 PM (23:00)
    const formatHour = (hour: HoursEnum): string => {
    return hour.toString().padStart(2, '0');
    };

    const is12HourFormat = (hour: HoursEnum): string => {
    if (hour === 0) return '12 AM';
    if (hour === 12) return '12 PM';
    if (hour < 12) return `${hour} AM`;
    return `${hour - 12} PM`;
    };

    type Midnight = 0 satisfies HoursEnum;
    type Noon = 12 satisfies HoursEnum;
    type ElevenPM = 23 satisfies HoursEnum;