chpark-sync #425
|
|
@ -75,10 +75,28 @@ export function RepeaterTable({
|
||||||
);
|
);
|
||||||
|
|
||||||
case "date":
|
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 (
|
return (
|
||||||
<Input
|
<Input
|
||||||
type="date"
|
type="date"
|
||||||
value={value || ""}
|
value={formatDateValue(value)}
|
||||||
onChange={(e) => handleCellEdit(rowIndex, column.field, e.target.value)}
|
onChange={(e) => handleCellEdit(rowIndex, column.field, e.target.value)}
|
||||||
className="h-7 text-xs"
|
className="h-7 text-xs"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue