- 루트 문서 30개를 도메인별 하위 폴더로 이동 - accounting/, architecture/, dev/, guides/, security/ 등 카테고리 분류 - archive/ 폴더에 QA 스크린샷 이동 - _index.md 문서 맵 업데이트 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3.5 KiB
3.5 KiB
금액/날짜 포맷터 공통화 계획
작성일: 2026-02-05 상태: ✅ 완료 목적: 중복 정의된 formatAmount, formatDate 함수를 공통 유틸로 통합
📊 현황 분석
이미 존재하는 유틸
| 파일 | 함수 | 설명 |
|---|---|---|
src/utils/formatAmount.ts |
formatAmount() |
자동 만원 변환 (1만 이상 → "N만원") |
formatAmountWon() |
항상 원 단위 ("N원") | |
formatAmountManwon() |
항상 만원 단위 ("N만원") | |
formatKoreanAmount() |
억/만 축약 ("1억 5,000만") | |
formatNumber() |
신규 단순 천단위 콤마 | |
src/utils/date.ts |
getLocalDateString() |
YYYY-MM-DD 반환 |
getTodayString() |
오늘 날짜 YYYY-MM-DD | |
formatDateForInput() |
input용 날짜 변환 | |
formatDate() |
신규 YYYY-MM-DD 표시용 | |
formatDateRange() |
신규 "시작 ~ 종료" 형식 |
📊 결과 요약
마이그레이션 완료 파일
formatAmount → formatNumber (12개 파일) ✅
| 파일 | 상태 |
|---|---|
construction/contract/ContractListClient.tsx |
✅ 완료 |
construction/contract/ContractDetailForm.tsx |
✅ 완료 |
construction/bidding/BiddingListClient.tsx |
✅ 완료 |
construction/bidding/BiddingDetailForm.tsx |
✅ 완료 |
construction/estimates/EstimateListClient.tsx |
✅ 완료 |
construction/estimates/modals/EstimateDocumentContent.tsx |
✅ 완료 |
construction/handover-report/HandoverReportListClient.tsx |
✅ 완료 |
construction/handover-report/HandoverReportDetailForm.tsx |
✅ 완료 |
construction/handover-report/modals/HandoverReportDocumentModal.tsx |
✅ 완료 |
construction/utility-management/UtilityManagementListClient.tsx |
✅ 완료 |
construction/estimates/utils/formatters.ts |
✅ re-export로 변경 |
formatDate 공통화 (7개 파일) ✅
| 파일 | 상태 |
|---|---|
construction/contract/ContractListClient.tsx |
✅ 완료 (formatDateRange) |
construction/bidding/BiddingListClient.tsx |
✅ 완료 |
construction/handover-report/HandoverReportListClient.tsx |
✅ 완료 (formatDateRange) |
construction/utility-management/UtilityManagementListClient.tsx |
✅ 완료 |
construction/issue-management/IssueManagementListClient.tsx |
✅ 완료 |
construction/structure-review/StructureReviewListClient.tsx |
✅ 완료 |
construction/management/ConstructionDetailClient.tsx |
✅ 완료 |
마이그레이션 제외 (한글 형식 유지)
| 파일 | 사유 |
|---|---|
handover-report/modals/HandoverReportDocumentModal.tsx |
한글 형식 ("년 월 일") |
order-management/modals/OrderDocumentModal.tsx |
한글 형식 ("년 월 일") |
📋 효과
| 항목 | Before | After |
|---|---|---|
| formatAmount 정의 | 12개 파일 | 1개 파일 (formatNumber) |
| formatDate 정의 | 8개 파일 | 1개 파일 |
| 중복 코드 라인 | ~150줄 | 0줄 |
| 포맷 변경 시 수정 | 20개 파일 | 1개 파일 |
⚠️ 주의사항
-
기존 formatAmount()와 formatNumber() 차이
- 기존
formatAmount(): 자동 만원 변환 (유지됨) - 신규
formatNumber(): 단순 천단위 콤마만
- 기존
-
한글 날짜 형식은 별도 유지
- 문서 모달에서 사용하는 "년 월 일" 형식은 로컬 유지
- 공통
formatDate()는 YYYY-MM-DD 형식만 처리
-
backward compatibility
estimates/utils/formatters.ts는formatNumber를formatAmount로 re-export