fix: 연월 포맷 수정 (년월일 -> -로 구분)

This commit is contained in:
swcho
2025-07-30 17:00:15 +09:00
parent 340814439a
commit bbfd7fd201
2 changed files with 10 additions and 7 deletions
+5 -3
View File
@@ -103,8 +103,10 @@ export const formatDateString = (dateStr: string): string => {
}
const year = cleanStr.substring(0, 4);
const month = parseInt(cleanStr.substring(4, 6)); // parseInt로 앞의 0 제거
const day = parseInt(cleanStr.substring(6, 8)); // parseInt로 앞의 0 제거
const month = cleanStr.substring(4, 6); // parseInt로 앞의 0 제거
// const month = parseInt(cleanStr.substring(4, 6)); // parseInt로 앞의 0 제거
// const day = parseInt(cleanStr.substring(6, 8)); // parseInt로 앞의 0 제거
const day = cleanStr.substring(6, 8); // parseInt로 앞의 0 제거
return `${year}년 ${month}월 ${day}일`;
return `${year}-${month}-${day}`;
};
@@ -21,7 +21,7 @@ export const formatDisplayData = (data: { [key: string]: any }): { [key: string]
if (/^\d{6}$/.test(dateStr)) {
const year = dateStr.substring(0, 4);
const month = parseInt(dateStr.substring(4, 6));
formattedData[fieldId] = `${year}년 ${month}월`;
formattedData[fieldId] = `${year}-${month}`;
} else {
formattedData[fieldId] = String(value);
}
@@ -45,9 +45,10 @@ export const formatDisplayData = (data: { [key: string]: any }): { [key: string]
// 🎯 undefined 체크 후 parseInt 적용
if (year && month && day && hour && minute) {
const formattedMonth = parseInt(month);
const formattedDay = parseInt(day);
formattedData[fieldId] = `${year}년 ${formattedMonth}월 ${formattedDay}일 ${hour}시 ${minute}분 ${second}초`;
// const formattedMonth = parseInt(month);
// const formattedDay = parseInt(day);
// formattedData[fieldId] = `${year}-${formattedMonth}-${formattedDay} ${hour}:${minute}:${second}`;
formattedData[fieldId] = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
} else {
formattedData[fieldId] = String(value);
}