fix(day): date the running list against the day on screen

DayRunning takes the viewed day, so a start in another year names its
year. The timeline's chronicle test reads the reworded gap line.
This commit is contained in:
Marc-André Bombeck committed 2026-10-09 13:53:33 +02:00
1 parent da92dabb55
commit b5f1077b94
3 files changed
+4 -6

No files matched your search

+2 -4
View File
@@ -215,13 +215,11 @@ export function DayRunning({
}: {
items: readonly DayRunningItem[];
/** The viewed day; a start date in another year names its year. */
date?: DateKey;
date: DateKey;
}) {
const { t, locale } = useTranslations();
if (items.length === 0) return null;
const viewedYear = date
? date.slice(0, 4)
: String(new Date().getUTCFullYear());
const viewedYear = date.slice(0, 4);
const intlLocale = resolveIntlLocale(locale);
const sinceText = (since: string): string =>
new Intl.DateTimeFormat(intlLocale, {
+1 -1
View File
@@ -332,7 +332,7 @@ export function DayView({
</p>
) : (
<>
<DayRunning items={data.running} />
<DayRunning items={data.running} date={date} />
{data.values.length > 0 ? (
<div className="space-y-2.5">
<DayValues values={data.values} focusTypes={focusTypes} />
@@ -143,7 +143,7 @@ describe("chronicle", () => {
)}
/>,
);
expect(html).toContain("April bis Oktober 2026 · keine Einträge");
expect(html).toContain("April bis Oktober 2026 ohne Einträge");
expect(html).toContain("Dauerhaft");
expect(html).toContain("2 Allergien");
expect(html).toContain("Erkältung vorbei");