fitness: fix duration display treating minutes as seconds

The DB stores duration in minutes but formatDuration was dividing
by 3600/60 as if receiving seconds, always showing 0m.
This commit is contained in:
2026-03-19 09:46:24 +01:00
parent dff67c7059
commit 620b955ea2
2 changed files with 8 additions and 8 deletions
@@ -20,10 +20,10 @@
*/
let { session } = $props();
/** @param {number} secs */
function formatDuration(secs) {
const h = Math.floor(secs / 3600);
const m = Math.floor((secs % 3600) / 60);
/** @param {number} mins */
function formatDuration(mins) {
const h = Math.floor(mins / 60);
const m = mins % 60;
if (h > 0) return `${h}h ${m}m`;
return `${m}m`;
}
+4 -4
View File
@@ -9,10 +9,10 @@
const session = $derived(data.session);
let deleting = $state(false);
/** @param {number} secs */
function formatDuration(secs) {
const h = Math.floor(secs / 3600);
const m = Math.floor((secs % 3600) / 60);
/** @param {number} mins */
function formatDuration(mins) {
const h = Math.floor(mins / 60);
const m = mins % 60;
if (h > 0) return `${h}h ${m}m`;
return `${m}m`;
}