diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts index 7c28f6eae6..7dde9aeb2d 100644 --- a/frontend/src/lib/utils.ts +++ b/frontend/src/lib/utils.ts @@ -72,14 +72,24 @@ export function displayDate( displayDate = true ): string { const date = new Date(dateString ?? '') - if (date.toString() === 'Invalid Date') { + if (Number.isNaN(date.valueOf())) { return '' } else { - return `${date.toLocaleTimeString([], { + const timeChoices: Intl.DateTimeFormatOptions = { hour: '2-digit', minute: '2-digit', second: displaySecond ? '2-digit' : undefined - })}${displayDate ? ` ${date.getDate()}/${date.getMonth() + 1}` : ''}` + } + const dateChoices: Intl.DateTimeFormatOptions = displayDate + ? { + day: 'numeric', + month: 'numeric' + } + : {} + return date.toLocaleString(undefined, { + ...timeChoices, + ...dateChoices + }) } } diff --git a/frontend/src/routes/(root)/(logged)/routes/+page.svelte b/frontend/src/routes/(root)/(logged)/routes/+page.svelte index 8906031338..2aae39245d 100644 --- a/frontend/src/routes/(root)/(logged)/routes/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/routes/+page.svelte @@ -301,11 +301,11 @@
edited by {edited_by}
the {displayDate(edited_at)}
+ > +
edited by {edited_by}
+
at {displayDate(edited_at)}
+ + {/each}