fitness: fix duration display treating minutes as seconds
All checks were successful
CI / update (push) Successful in 1m58s
All checks were successful
CI / update (push) Successful in 1m58s
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:
@@ -20,10 +20,10 @@
|
|||||||
*/
|
*/
|
||||||
let { session } = $props();
|
let { session } = $props();
|
||||||
|
|
||||||
/** @param {number} secs */
|
/** @param {number} mins */
|
||||||
function formatDuration(secs) {
|
function formatDuration(mins) {
|
||||||
const h = Math.floor(secs / 3600);
|
const h = Math.floor(mins / 60);
|
||||||
const m = Math.floor((secs % 3600) / 60);
|
const m = mins % 60;
|
||||||
if (h > 0) return `${h}h ${m}m`;
|
if (h > 0) return `${h}h ${m}m`;
|
||||||
return `${m}m`;
|
return `${m}m`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
const session = $derived(data.session);
|
const session = $derived(data.session);
|
||||||
let deleting = $state(false);
|
let deleting = $state(false);
|
||||||
|
|
||||||
/** @param {number} secs */
|
/** @param {number} mins */
|
||||||
function formatDuration(secs) {
|
function formatDuration(mins) {
|
||||||
const h = Math.floor(secs / 3600);
|
const h = Math.floor(mins / 60);
|
||||||
const m = Math.floor((secs % 3600) / 60);
|
const m = mins % 60;
|
||||||
if (h > 0) return `${h}h ${m}m`;
|
if (h > 0) return `${h}h ${m}m`;
|
||||||
return `${m}m`;
|
return `${m}m`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user