const formatHour = (hour: HoursEnum): string =>
hour.toString().padStart(2, '0');
const is12HourFormat = (hour: HoursEnum): string =>
hour === 0
? '12 AM'
: hour === 12
? '12 PM'
: hour < 12
? `${hour} AM`
: `${hour - 12} PM`;
const midnight = 0 satisfies HoursEnum;
const noon = 12 satisfies HoursEnum;
const elevenPM = 23 satisfies HoursEnum;
Represents the hours in a day using 24-hour format. A union of integer literals from
0(midnight) to23(11 PM).Uses the international standard 24-hour time format where:
0represents midnight (00:00)12represents noon (12:00)23represents 11 PM (23:00)