From 0363aff1d4c873a6f8acdd59a3a0c28899ee5051 Mon Sep 17 00:00:00 2001 From: Mattsson <111893710+mattssonn@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:13:23 +0200 Subject: [PATCH] fix(pdf): correct negative amount formatting in operational report PDF (#378) --- lib/reports/operational-report-pdf-template.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/reports/operational-report-pdf-template.tsx b/lib/reports/operational-report-pdf-template.tsx index bae10e72..9ee6225e 100644 --- a/lib/reports/operational-report-pdf-template.tsx +++ b/lib/reports/operational-report-pdf-template.tsx @@ -224,10 +224,15 @@ const styles = StyleSheet.create({ }) function formatAmount(amount: number): string { + // Intl emits U+2212 (true minus). The bundled @react-pdf/renderer + // Helvetica/Courier fonts lack that glyph and silently drop it, so + // negatives would render as positives. Map to ASCII hyphen. return new Intl.NumberFormat('sv-SE', { minimumFractionDigits: 2, maximumFractionDigits: 2, - }).format(amount) + }) + .format(amount) + .replace(/\u2212/g, '-') } function formatOrgNumber(orgNumber: string): string {