feat(activity): show visible creation date on each row
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.
This commit is contained in:
parent
443702d222
commit
38db772b4f
1 changed files with 16 additions and 5 deletions
|
|
@ -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}<p class="muted">🕒 {formatDate(decrypted.scheduled_at)}</p>{/if}
|
||||
<p class="muted" style="font-size: 0.8rem;">Lagt til {formatDateOnly(activity.created_at)}</p>
|
||||
{:else if !session.dek}
|
||||
<h3 id={`act-${activity.id}-h`} style="display: flex; align-items: center;">
|
||||
<span class="vis-badge private">Privat</span>
|
||||
|
|
@ -276,17 +286,18 @@
|
|||
{@render locationLine(activity.loc_label, activity.loc_lat, activity.loc_lng)}
|
||||
{/if}
|
||||
{#if activity.scheduled_at}<p class="muted">🕒 {formatDate(activity.scheduled_at)}</p>{/if}
|
||||
{#if activity.visibility === 'public' && activity.owner_display}
|
||||
<p class="muted" style="font-size: 0.8rem;">
|
||||
Lagt til av
|
||||
<p class="muted" style="font-size: 0.8rem;">
|
||||
Lagt til {formatDateOnly(activity.created_at)}
|
||||
{#if activity.visibility === 'public' && activity.owner_display}
|
||||
av
|
||||
{#if activity.owner_username}
|
||||
<a href={`/${activity.owner_username}/liste`}
|
||||
onclick={(e) => onSpaLink(e, `/${activity.owner_username}/liste`)}>{activity.owner_display}</a>
|
||||
{:else}
|
||||
{activity.owner_display}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div class="row" style="margin-top: 0.5rem;">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue