fix: short hour format now shows just the number (8, 9, 10)

The formatHour function was ignoring the format parameter in 24h
mode, always returning HH:MM. Now "short" returns just the hour
number without leading zero or :00.

v1.49.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin 2026-03-18 17:17:41 +01:00
parent 4757dc3cdb
commit 3eff24143c
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.49.0", "version": "1.49.1",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1400,8 +1400,10 @@ function formatHour(hour: number, minutes: number = 0, format: "short" | "full"
const m = minutes > 0 ? `:${minutes.toString().padStart(2, "0")}` : ""; const m = minutes > 0 ? `:${minutes.toString().padStart(2, "0")}` : "";
return format === "full" || minutes > 0 ? `${h}:${minutes.toString().padStart(2, "0")} ${ampm}` : `${h}${m} ${ampm}`; return format === "full" || minutes > 0 ? `${h}:${minutes.toString().padStart(2, "0")} ${ampm}` : `${h}${m} ${ampm}`;
} }
// 24h format: always show minutes if non-zero, or if format is full. // 24h format
// Standardize to always include :00 for the hour start to avoid ambiguity. if (format === "short" && minutes === 0) {
return `${hour}`;
}
return `${hour.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`; return `${hour.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
} }