feat: elapsed + drift formatting helpers
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export function fmtElapsed(ms) {
|
||||
const total = Math.floor(ms / 1000);
|
||||
const h = Math.floor(total / 3600);
|
||||
const m = Math.floor((total % 3600) / 60);
|
||||
return `${h}:${String(m).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
export function fmtDrift(driftMin) {
|
||||
if (driftMin == null) return '';
|
||||
const r = Math.round(driftMin);
|
||||
if (r === 0) return 'on time';
|
||||
return r > 0 ? `+${r} behind` : `${Math.abs(r)} ahead`;
|
||||
}
|
||||
Reference in New Issue
Block a user