mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
chore(release): v1.28.35 — timestamps honor the profile timezone
Client-rendered times fell back to the hardcoded display zone (Europe/Berlin) because neither useFormatters() nor the legacy format.ts helpers ever received users.timezone. A third localStorage mirror (timezone-mirror.ts, following the time-format/date-format pattern) carries the validated profile zone from /api/auth/me into both read paths; the fallback chain is strictly profile → Europe/Berlin — never the browser zone, so screen, PDF, and export cannot disagree. makeFormatters validates its zone before Intl (a poison value falls back instead of throwing inside every render). Same pass, per the two-document audit: formatUpdatedLabel boundary and clock now resolve one zone in every state (the undefined-tz browser hole is closed); @db.Date calendar fields render UTC-pinned so profiles west of UTC cannot shift a day; dose-history day headings and GLP-1 weekday labels derive from the display zone; chart day/month labels are encoding-derived and UTC-pinned (bucket math untouched, byte-identical for Berlin profiles); the clinician share view renders in the patient's timezone instead of the container's; Playwright pins Europe/Berlin. Server day-key semantics, streak anchoring, insight cache keys, and verbatim wall-clock strings are untouched by construction and pinned by the new Auckland/New_York/Manila + DST test matrix.
This commit is contained in:
1 parent
136653e3d7
commit
9bbd8a89dc
41 files changed
+958
-90
No files matched your search
@@ -36,6 +36,11 @@ vi.mock("@/lib/clinician-share/resolve-share-token", () => ({
|
||||
vi.mock("@/lib/clinician-share/share-view-data", () => ({
|
||||
loadShareViewData: vi.fn(),
|
||||
}));
|
||||
// Issue #490 — the page resolves the share OWNER's timezone for the date
|
||||
// rendering; the Prisma-backed resolver is stubbed like the data loader.
|
||||
vi.mock("@/lib/tz/resolver", () => ({
|
||||
resolveUserTimezone: vi.fn(async () => "Europe/Berlin"),
|
||||
}));
|
||||
vi.mock("@/components/clinician/clinician-view", () => ({
|
||||
ClinicianView: () => null,
|
||||
}));
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
import { getServerTranslator } from "@/lib/i18n/server-translator";
|
||||
import { defaultLocale, locales, type Locale } from "@/lib/i18n/config";
|
||||
import { parseLocaleFromAcceptLanguage } from "@/lib/format-locale";
|
||||
import { resolveUserTimezone } from "@/lib/tz/resolver";
|
||||
import { ClinicianView } from "@/components/clinician/clinician-view";
|
||||
import { ShareUnlockGate } from "@/components/clinician/share-unlock-gate";
|
||||
|
||||
@@ -103,8 +104,15 @@ export default async function ClinicianSharePage({
|
||||
const context = await resolveShareToken(token);
|
||||
if (!context) notFound();
|
||||
|
||||
const [{ report, sections, documents, documentOnly }, locale] =
|
||||
await Promise.all([loadShareViewData(context), resolveLocale()]);
|
||||
// Issue #490 — period/expiry dates render in the share OWNER's (patient's)
|
||||
// profile timezone so they agree with the patient-tz aggregation behind the
|
||||
// stats and with the doctor-report PDF (never the container's zone).
|
||||
const [{ report, sections, documents, documentOnly }, locale, ownerTimezone] =
|
||||
await Promise.all([
|
||||
loadShareViewData(context),
|
||||
resolveLocale(),
|
||||
resolveUserTimezone(context.ownerUserId),
|
||||
]);
|
||||
const { t } = getServerTranslator(locale);
|
||||
|
||||
return (
|
||||
@@ -118,6 +126,7 @@ export default async function ClinicianSharePage({
|
||||
documentOnly={documentOnly}
|
||||
token={token}
|
||||
locale={locale}
|
||||
timezone={ownerTimezone}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ interface ComprehensiveMoodData {
|
||||
}
|
||||
|
||||
export default function InsightsStimmungPage() {
|
||||
const { isAuthenticated, user } = useAuth();
|
||||
const { isAuthenticated } = useAuth();
|
||||
const { t } = useTranslations();
|
||||
const { compareBaseline } = useInsightsLayoutPrefs(isAuthenticated);
|
||||
|
||||
@@ -107,11 +107,7 @@ export default function InsightsStimmungPage() {
|
||||
MeasurementType series, so the period-over-period range read
|
||||
(`/api/analytics/range`, keyed on a MeasurementType enum) has
|
||||
nothing to aggregate. */}
|
||||
<MoodChart
|
||||
chartKey="mood"
|
||||
compareBaseline={compareBaseline}
|
||||
userTimezone={user?.timezone}
|
||||
/>
|
||||
<MoodChart chartKey="mood" compareBaseline={compareBaseline} />
|
||||
|
||||
<MetricTargetSummary slug="mood" />
|
||||
|
||||
|
||||
@@ -1375,7 +1375,6 @@ export default function DashboardPageClient() {
|
||||
onDataReady={() => markChartReady("mood-chart")}
|
||||
compareBaseline={compareBaseline}
|
||||
chartKey="mood"
|
||||
userTimezone={user?.timezone}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user