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();
|
||||
|
||||
/** @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`;
|
||||
}
|
||||
|
||||
@@ -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`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user