Merge ksh branch up to commit 5d3b3ea7 (날짜 필드 ISO 형식 변환 수정)
This commit is contained in:
commit
7a185ca1ed
|
|
@ -75,10 +75,28 @@ export function RepeaterTable({
|
|||
);
|
||||
|
||||
case "date":
|
||||
// ISO 형식(2025-11-23T00:00:00.000Z)을 yyyy-mm-dd로 변환
|
||||
const formatDateValue = (val: any): string => {
|
||||
if (!val) return "";
|
||||
// 이미 yyyy-mm-dd 형식이면 그대로 반환
|
||||
if (typeof val === "string" && /^\d{4}-\d{2}-\d{2}$/.test(val)) {
|
||||
return val;
|
||||
}
|
||||
// ISO 형식이면 날짜 부분만 추출
|
||||
if (typeof val === "string" && val.includes("T")) {
|
||||
return val.split("T")[0];
|
||||
}
|
||||
// Date 객체이면 변환
|
||||
if (val instanceof Date) {
|
||||
return val.toISOString().split("T")[0];
|
||||
}
|
||||
return String(val);
|
||||
};
|
||||
|
||||
return (
|
||||
<Input
|
||||
type="date"
|
||||
value={value || ""}
|
||||
value={formatDateValue(value)}
|
||||
onChange={(e) => handleCellEdit(rowIndex, column.field, e.target.value)}
|
||||
className="h-7 text-xs"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue