mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
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:
1 parent
da92dabb55
commit
b5f1077b94
3 files changed
+4
-6
No files matched your search
@@ -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, {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user