Files
familienarchiv/frontend/src/lib/document/DocumentTopBarTitle.svelte
Marcel b56b9dfa74 feat(frontend): render honest precision dates in detail, list and search
Wires formatDocumentDate/DocumentDate into the read sites: the document
detail top bar + metadata drawer (the drawer shows the visible "Originaltext:"
raw line for UNKNOWN/SEASON/APPROX), the search/list rows (DocumentRow,
mobile + desktop), and the document multi-select dropdown label. A MONTH or
SEASON document now reads "Juni 1916"/"Sommer 1916" everywhere instead of a
fabricated day.

Adds metaDatePrecision to the DocumentRow/DocumentMultiSelect test fixtures
(required on DocumentListItem since #671) and updates the multi-select label
assertion to the honest long date.

Refs #666

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 11:56:49 +02:00

43 lines
1.1 KiB
Svelte

<script lang="ts">
import { formatDocumentDate, type DatePrecision } from '$lib/shared/utils/documentDate';
import { getLocale } from '$lib/paraglide/runtime.js';
type Props = {
title?: string | null;
originalFilename?: string | null;
documentDate?: string | null;
metaDatePrecision?: DatePrecision | null;
metaDateEnd?: string | null;
metaDateRaw?: string | null;
};
let {
title,
originalFilename,
documentDate,
metaDatePrecision = null,
metaDateEnd = null,
metaDateRaw = null
}: Props = $props();
const displayTitle = $derived(title || originalFilename || '');
const precision = $derived<DatePrecision>(metaDatePrecision ?? (documentDate ? 'DAY' : 'UNKNOWN'));
const dateLabel = $derived(
documentDate
? formatDocumentDate(documentDate, precision, metaDateEnd, metaDateRaw, getLocale())
: null
);
</script>
<div class="min-w-0 flex-1 overflow-hidden">
<h1
class="truncate font-serif text-[18px] leading-tight text-ink lg:text-[20px]"
title={displayTitle}
>
{displayTitle}
</h1>
{#if dateLabel}
<p class="font-sans text-[16px] text-ink-2">{dateLabel}</p>
{/if}
</div>