queueEta.ts 562 B

123456789101112131415161718
  1. import { formatETA, type TimeFormat } from './date';
  2. /**
  3. * Formats the estimated completion time for a queue item if it were
  4. * started at the current time.
  5. *
  6. * This is deliberately a per-job estimate rather than a cumulative
  7. * queue forecast.
  8. */
  9. export function formatQueueItemETA(
  10. printTimeSeconds: number | null | undefined,
  11. timeFormat: TimeFormat = 'system',
  12. t?: Parameters<typeof formatETA>[2],
  13. ): string | null {
  14. if (printTimeSeconds == null || printTimeSeconds <= 0) return null;
  15. return formatETA(printTimeSeconds / 60, timeFormat, t);
  16. }