From 38db772b4fea99231046e271715574a37a432534 Mon Sep 17 00:00:00 2001 From: Ole-Morten Duesund Date: Mon, 25 May 2026 18:50:57 +0200 Subject: [PATCH] feat(activity): show visible creation date on each row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a "Lagt til DD.MM.YYYY" line to ActivityRow. For public rows the existing owner-attribution snippet folds into the same muted footer line so it reads naturally ("Lagt til 25.05.2026 av Ole-Morten"). Private rows just get the date — they have no public attribution. Date-only is intentional (per spec: "Det holder med dato"). created_at is epoch milliseconds, not seconds like scheduled_at, so a separate formatDateOnly helper avoids confusing the two. --- frontend/src/components/ActivityRow.svelte | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/ActivityRow.svelte b/frontend/src/components/ActivityRow.svelte index 2aa0acd..1ba08f6 100644 --- a/frontend/src/components/ActivityRow.svelte +++ b/frontend/src/components/ActivityRow.svelte @@ -51,6 +51,15 @@ }); } + // created_at is epoch *milliseconds* (Date.now() on the server). The + // existing formatDate above takes seconds because scheduled_at is stored + // that way. Date-only is enough for "added on" — time of day is noise. + function formatDateOnly(epochMs: number): string { + return new Date(epochMs).toLocaleDateString('nb-NO', { + year: 'numeric', month: '2-digit', day: '2-digit', + }); + } + /** * OpenStreetMap link for a location. * - If coordinates are present → /?mlat=…&mlon=…&zoom=15 (shows a pin) @@ -229,6 +238,7 @@ {@render locationLine(decrypted.loc_label, null, null)} {/if} {#if decrypted.scheduled_at}

🕒 {formatDate(decrypted.scheduled_at)}

{/if} +

Lagt til {formatDateOnly(activity.created_at)}

{:else if !session.dek}

Privat @@ -276,17 +286,18 @@ {@render locationLine(activity.loc_label, activity.loc_lat, activity.loc_lng)} {/if} {#if activity.scheduled_at}

🕒 {formatDate(activity.scheduled_at)}

{/if} - {#if activity.visibility === 'public' && activity.owner_display} -

- Lagt til av +

+ Lagt til {formatDateOnly(activity.created_at)} + {#if activity.visibility === 'public' && activity.owner_display} + av {#if activity.owner_username} onSpaLink(e, `/${activity.owner_username}/liste`)}>{activity.owner_display} {:else} {activity.owner_display} {/if} -

- {/if} + {/if} +

{/if}