From 8dd49e4fa2ff129300f32cad4082060ffd142505 Mon Sep 17 00:00:00 2001 From: kent Date: Tue, 13 Jan 2026 19:48:08 +0900 Subject: [PATCH] =?UTF-8?q?feat(WEB):=20formatAmount=20=EC=9C=A0=ED=8B=B8?= =?UTF-8?q?=EB=A6=AC=ED=8B=B0=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/formatAmount.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/formatAmount.ts b/src/utils/formatAmount.ts index f4c8ddc1..dcc845a4 100644 --- a/src/utils/formatAmount.ts +++ b/src/utils/formatAmount.ts @@ -6,6 +6,11 @@ */ export function formatAmount(amount: number): string { + // NaN, undefined, null 처리 + if (amount == null || isNaN(amount)) { + return "0원"; + } + if (amount < 10000) { return `${amount.toLocaleString("ko-KR")}원`; } else { @@ -18,6 +23,10 @@ export function formatAmount(amount: number): string { * 금액을 원 단위로 포맷 (항상 "원" 단위) */ export function formatAmountWon(amount: number): string { + // NaN, undefined, null 처리 + if (amount == null || isNaN(amount)) { + return "0원"; + } return `${amount.toLocaleString("ko-KR")}원`; }