fix(M01): 200 원 미만 단가는 유효숫자로 — 상세 · 모달 단가 (PLAN 5장 5바퀴)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
This commit is contained in:
2026-09-24 11:44:34 +09:00
co-authored by Claude Sonnet 5
parent 0d81acc7d3
commit 68daa24259
3 changed files with 15 additions and 7 deletions
@@ -9,3 +9,11 @@ export const formatMoney = (value: unknown): string =>
typeof value === "number"
? value.toLocaleString("ko-KR", { maximumFractionDigits: 0 })
: formatNumber(value);
/** 단가 모양 — 정수로 보이되 200 원 미만은 반올림 오차가 커서 소수 넷째 자리·유효숫자 4 자리 중 많은 쪽(뒤 0 뗌) */
export const formatPrice = (value: unknown): string =>
typeof value === "number" && value !== 0 && Math.abs(value) < 200
? value.toLocaleString("ko-KR", {
maximumFractionDigits: Math.max(4, 3 - Math.floor(Math.log10(Math.abs(value)))),
})
: formatMoney(value);