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")}원`; }