mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 15:02:04 +00:00
feat(doctor-report): PDF timestamps render in user displayTimezone
v1.4.25 W7 phase 3.3 — closes proposal §3 symptom 8. renderDoctorReportPdfBytes now accepts an optional userTz in its DoctorReportRenderOptions. The PDF route resolves the patient's stored timezone via the v1.4.25 W7 resolver and threads it through makeFormatters so date/time rows render in the user's zone. A US patient generating a report at home in Boston now sees Eastern time rows, not Berlin. Existing Berlin-region users see no behaviour change — the User.timezone default is Europe/Berlin and the formatter falls back when userTz is empty. Client-side caller (settings dialog) is untouched in this commit — a follow-up wave wires the auth-context value through the dialog component.
This commit is contained in:
1 parent
72e64c816d
commit
ce6d6be95a
2 files changed
+16
-4
No files matched your search
@@ -14,6 +14,7 @@ import { renderDoctorReportPdfBytes } from "@/lib/doctor-report-pdf-core";
|
||||
import { getServerTranslator } from "@/lib/i18n/server-translator";
|
||||
import { parseLocaleFromAcceptLanguage } from "@/lib/format-locale";
|
||||
import { locales, type Locale } from "@/lib/i18n/config";
|
||||
import { resolveUserTimezone } from "@/lib/tz/resolver";
|
||||
|
||||
/**
|
||||
* Server-rendered PDF doctor report.
|
||||
@@ -58,10 +59,13 @@ export const POST = apiHandler(async (request: NextRequest) => {
|
||||
}
|
||||
}
|
||||
|
||||
const data = await collectDoctorReportData(user.id, range, { practiceName });
|
||||
const [data, userTz] = await Promise.all([
|
||||
collectDoctorReportData(user.id, range, { practiceName }),
|
||||
resolveUserTimezone(user.id),
|
||||
]);
|
||||
|
||||
const { t } = getServerTranslator(locale);
|
||||
const pdfBytes = renderDoctorReportPdfBytes(data, { t, locale });
|
||||
const pdfBytes = renderDoctorReportPdfBytes(data, { t, locale, userTz });
|
||||
|
||||
await auditLog("doctor-report.pdf.generate", {
|
||||
userId: user.id,
|
||||
|
||||
Reference in new issue
Block a user