fix(dates): show the year whenever a date is not the current one

Sweeps every surface that renders a date from before this year without
a year suffix — illness episodes/flares/day-logs, lab and custom-metric
charts, the mood chart family, medication titration/side-effects/dose-
history/next-dose captions (incl. the Dec→Jan rollover), cycle
predictions and history, the BBT chart, the intraday-pulse day-nav, the
date-range filter chip, and the nutrient/compliance charts. Each now
routes through dateShortSmart / dateWithWeekdaySmart (format-locale.ts)
or the matching date-format.ts helper, which add the year only when it
differs from the current one — mirroring the workout list's existing
model instead of a bare "19.02." that reads as this year's.

Also fixes two sites that bypassed the app's locale entirely: the
trusted-devices expiry (bare toLocaleDateString, host locale) and the
admin token-name timestamp (hard-coded de-DE + Europe/Berlin) now both
render through the user's own locale, hour-cycle, and timezone
preference.
This commit is contained in:
Marc-André Bombeck committed 2026-07-18 01:23:37 +02:00
1 parent 7f44e2fa37
commit 1ff179178f
28 files changed
+158 -104

No files matched your search

@@ -34,7 +34,7 @@ function DayLogRow({ log }: { log: IllnessDayLogDTO }) {
return (
<div className="border-border/60 space-y-2 border-l-2 pl-3">
<p className="text-muted-foreground text-xs font-medium tracking-wide uppercase">
{fmt.dateShort(`${log.date}T12:00:00`)}
{fmt.dateShortSmart(`${log.date}T12:00:00`)}
</p>
{log.symptoms.length > 0 ? (
@@ -82,11 +82,11 @@ export function IllnessEpisodeDetail({ episodeId }: { episodeId: string }) {
</Badge>
<span className="text-muted-foreground text-xs">
{t("illness.onsetOn", {
date: fmt.dateShort(new Date(episode.onsetAt)),
date: fmt.dateShortSmart(new Date(episode.onsetAt)),
})}
{episode.resolvedAt
? ` · ${t("illness.recoveredOn", {
date: fmt.dateShort(new Date(episode.resolvedAt)),
date: fmt.dateShortSmart(new Date(episode.resolvedAt)),
})}`
: ""}
</span>
+1 -1
View File
@@ -43,7 +43,7 @@ export function IllnessSettings() {
: e.lifecycle === "CHRONIC_ONGOING"
? t("illness.status.ongoing")
: t("illness.status.active")
} · ${fmt.dateShort(new Date(e.onsetAt))}`,
} · ${fmt.dateShortSmart(new Date(e.onsetAt))}`,
}));
return (
+4 -4
View File
@@ -103,7 +103,7 @@ function EpisodeCard({
: t("illness.status.recovered")}
</Badge>
<span className="text-muted-foreground">
{fmt.dateShort(new Date(episode.onsetAt))}
{fmt.dateShortSmart(new Date(episode.onsetAt))}
</span>
</div>
</div>
@@ -167,11 +167,11 @@ function EpisodeCard({
<p className="text-muted-foreground text-xs">
{t("illness.onsetOn", {
date: fmt.dateShort(new Date(episode.onsetAt)),
date: fmt.dateShortSmart(new Date(episode.onsetAt)),
})}
{episode.resolvedAt
? ` · ${t("illness.recoveredOn", {
date: fmt.dateShort(new Date(episode.resolvedAt)),
date: fmt.dateShortSmart(new Date(episode.resolvedAt)),
})}`
: ""}
</p>
@@ -192,7 +192,7 @@ function EpisodeCard({
>
<span className="truncate">{flare.label}</span>
<span className="text-muted-foreground shrink-0">
{fmt.dateShort(new Date(flare.onsetAt))}
{fmt.dateShortSmart(new Date(flare.onsetAt))}
</span>
</Link>
</li>