format: run prettify

This commit is contained in:
SethBurkart123
2025-05-05 18:04:10 +10:00
parent 771169348f
commit 0f9f618164
142 changed files with 28768 additions and 20790 deletions
+20 -20
View File
@@ -1,21 +1,21 @@
export function convertTo12HourFormat(
time: string,
noMinutes: boolean = false,
): string {
let [hours, minutes] = time.split(":").map(Number)
let period = "AM"
if (hours >= 12) {
period = "PM"
if (hours > 12) hours -= 12
} else if (hours === 0) {
hours = 12
}
let hoursStr = hours.toString()
if (hoursStr.length === 2 && hoursStr.startsWith("0")) {
hoursStr = hoursStr.substring(1)
}
return `${hoursStr}${noMinutes ? "" : `:${minutes.toString().padStart(2, "0")}`} ${period}`
}
time: string,
noMinutes: boolean = false,
): string {
let [hours, minutes] = time.split(":").map(Number);
let period = "AM";
if (hours >= 12) {
period = "PM";
if (hours > 12) hours -= 12;
} else if (hours === 0) {
hours = 12;
}
let hoursStr = hours.toString();
if (hoursStr.length === 2 && hoursStr.startsWith("0")) {
hoursStr = hoursStr.substring(1);
}
return `${hoursStr}${noMinutes ? "" : `:${minutes.toString().padStart(2, "0")}`} ${period}`;
}