mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-04 13:11:35 +02:00
19 lines
562 B
TypeScript
19 lines
562 B
TypeScript
import { formatETA, type TimeFormat } from './date';
|
|
|
|
/**
|
|
* Formats the estimated completion time for a queue item if it were
|
|
* started at the current time.
|
|
*
|
|
* This is deliberately a per-job estimate rather than a cumulative
|
|
* queue forecast.
|
|
*/
|
|
export function formatQueueItemETA(
|
|
printTimeSeconds: number | null | undefined,
|
|
timeFormat: TimeFormat = 'system',
|
|
t?: Parameters<typeof formatETA>[2],
|
|
): string | null {
|
|
if (printTimeSeconds == null || printTimeSeconds <= 0) return null;
|
|
|
|
return formatETA(printTimeSeconds / 60, timeFormat, t);
|
|
}
|