diff --git a/src/lib/ldb/staff/table/table-generator.svelte b/src/lib/ldb/staff/table/table-generator.svelte index d8ead40..bd036cd 100644 --- a/src/lib/ldb/staff/table/table-generator.svelte +++ b/src/lib/ldb/staff/table/table-generator.svelte @@ -87,11 +87,15 @@ }; } - function fmtTime(date: Date | undefined): string | false { - if (!date) return false; // Handle null or undefined dates - const hours = date.getHours().toString().padStart(2, '0'); - const minutes = date.getMinutes().toString().padStart(2, '0'); - return `${hours}:${minutes}`; + function fmtTime(date: Date | string | undefined): string | false { + if (date === 'RT' || date === "CANC" || date === "LATE") return date; + if (date instanceof Date) { + const hours = date.getHours().toString().padStart(2, '0'); + const minutes = date.getMinutes().toString().padStart(2, '0'); + return `${hours}:${minutes}`; + } else { + return false; + } } @@ -141,7 +145,7 @@ - {#if service.destination?.[0]?.via}{service.destination[0].via}
{/if} + {#if service.destination?.[0] && service.destination[0].via}{service.destination[0].via}
{/if} {tocMap.get(service.operatorCode.toLowerCase()) || service.operatorCode} {#if service.length} | {service.length} carriages{/if} {#if service.delayReason}