diff --git a/frontend/src/pages/uiws/ScheduleCalendar.tsx b/frontend/src/pages/uiws/ScheduleCalendar.tsx index 5a03426..f9abbab 100644 --- a/frontend/src/pages/uiws/ScheduleCalendar.tsx +++ b/frontend/src/pages/uiws/ScheduleCalendar.tsx @@ -84,16 +84,22 @@ export default function ScheduleCalendar() { ) } +// datetime-local(yyyy-MM-ddTHH:mm) → API 계약(yyyy-MM-ddTHH:mm:ss) 보정: 초 없으면 :00 부가 +function toApiDt(v: string): string { + if (!v) return v + return v.length === 16 ? `${v}:00` : v +} + function ScheduleForm({ date, type, onClose, onSaved }: { date: string; type: string; onClose: () => void; onSaved: () => void }) { const [title, setTitle] = useState('') - const [startDt, setStartDt] = useState(`${date}T09:00:00`) - const [endDt, setEndDt] = useState(`${date}T18:00:00`) + const [startDt, setStartDt] = useState(`${date}T09:00`) + const [endDt, setEndDt] = useState(`${date}T18:00`) const [content, setContent] = useState('') const [err, setErr] = useState('') const save = async () => { setErr('') try { - await createSchedule({ scheType: type, title, startDt, endDt, content, attachmentIds: [] }) + await createSchedule({ scheType: type, title, startDt: toApiDt(startDt), endDt: toApiDt(endDt), content, attachmentIds: [] }) onSaved() } catch (e: any) { setErr(e?.response?.data?.message || '저장 실패') } } @@ -101,8 +107,8 @@ function ScheduleForm({ date, type, onClose, onSaved }: { date: string; type: st }> - - + + {err &&
{err}
}