Update time formatting
This commit is contained in:
parent
09abfd4436
commit
b173410dd6
@ -87,11 +87,15 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function fmtTime(date: Date | undefined): string | false {
|
function fmtTime(date: Date | string | undefined): string | false {
|
||||||
if (!date) return false; // Handle null or undefined dates
|
if (date === 'RT' || date === "CANC" || date === "LATE") return date;
|
||||||
const hours = date.getHours().toString().padStart(2, '0');
|
if (date instanceof Date) {
|
||||||
const minutes = date.getMinutes().toString().padStart(2, '0');
|
const hours = date.getHours().toString().padStart(2, '0');
|
||||||
return `${hours}:${minutes}`;
|
const minutes = date.getMinutes().toString().padStart(2, '0');
|
||||||
|
return `${hours}:${minutes}`;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -141,7 +145,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="1" />
|
<td colspan="1" />
|
||||||
<td class="tableTxt" colspan="7">
|
<td class="tableTxt" colspan="7">
|
||||||
{#if service.destination?.[0]?.via}<span class="via">{service.destination[0].via}</span><br />{/if}
|
{#if service.destination?.[0] && service.destination[0].via}<span class="via">{service.destination[0].via}</span><br />{/if}
|
||||||
{tocMap.get(service.operatorCode.toLowerCase()) || service.operatorCode}
|
{tocMap.get(service.operatorCode.toLowerCase()) || service.operatorCode}
|
||||||
{#if service.length} | {service.length} carriages{/if}
|
{#if service.length} | {service.length} carriages{/if}
|
||||||
{#if service.delayReason}
|
{#if service.delayReason}
|
||||||
|
Loading…
Reference in New Issue
Block a user