feat(WEB): formatAmount 유틸리티 기능 추가

This commit is contained in:
2026-01-13 19:48:08 +09:00
parent 42b0a5778e
commit 8dd49e4fa2

View File

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