fix: handle negative-zero and half-cent rounding in formatGermanAmount

This commit is contained in:
Bastian Wagner
2026-08-03 21:12:27 +02:00
parent cab04c5869
commit c6df6a6d38
2 changed files with 25 additions and 1 deletions

View File

@@ -68,7 +68,9 @@ const TYPE_LABELS: Record<string, string> = {
};
function formatGermanAmount(value: number): string {
return value.toFixed(2).replace('.', ',');
const rounded = Math.round((value + Number.EPSILON) * 100) / 100;
const normalized = rounded === 0 ? 0 : rounded;
return normalized.toFixed(2).replace('.', ',');
}
function escapeCsvField(value: string): string {