Update table display on board page, in preparation for offering different 'table' styles.

This commit is contained in:
2026-05-11 12:04:40 +01:00
parent 13d22d7b73
commit 7edccf294b
6 changed files with 97 additions and 45 deletions

View File

@@ -102,3 +102,27 @@ export function calculateDelay(loc: DelayInput): {
return { val: `${absDiff}E`, type: 'early' };
}
}
/**
* Accepts a pair of times (string or Date) and outputs a delay class 'delay-early', 'delay-late' or 'delay-rt'
* @param sched Scheduled Time (string, Date)
* @param act Actual Time (string, Date)
*/
export function delayClassFromTimePair(sched: any, act: any): string {
if (!sched || !act) return '';
const s = new Date(sched).getTime();
const a = new Date(act).getTime();
if (isNaN(s) || isNaN(a)) return '';
const diff = a - s;
const oneMinute = 60000;
// on-time if within one minute
if (Math.abs(diff) < oneMinute) {
return 'delay-rt';
}
return diff > 0 ? 'delay-late' : 'delay-early';
}