diff --git a/src/lib/ldb/staff-ldb.svelte b/src/lib/ldb/staff-ldb.svelte index 96c04fd..e591a25 100644 --- a/src/lib/ldb/staff-ldb.svelte +++ b/src/lib/ldb/staff-ldb.svelte @@ -91,6 +91,15 @@ } return {data: output, changed: change} } + + function parseDateTime(input) { + const dt = new Date(input); + const output = dt.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}) + if (output !== "Invalid Date") { + return output + } + return '-' + } onMount(() => { fetchData(); @@ -102,18 +111,57 @@ {:else}

Updated: {dataAge.toLocaleTimeString()}

-

Staff LDB for {station}

- - {#each services as service} -
-

{service.operatorCode}

-

{service.trainid}

-

{service.origin.location.tiploc}

-

{service.destination.location.tiploc}

-

{service.platform}

-

{new Date(service.sta).toLocaleTimeString() || '-'}

-
- {/each} + + + + + + + + + + + + {#each services as service} + + + + + + + + + + + + + + {/each} +
IDFromToPlatSch ArrExp ArrSch DepExp Dep
{service.trainid}{service.origin.location.tiploc}{service.destination.location.tiploc}{service.platform || '-'}{parseDateTime(service.sta)}{'-'}{parseDateTime(service.std)}{'-'}
+ {service.operator} +
{/if} -