From 03262d65cbfcbaa7ed3694e7d54dbefaa330200c Mon Sep 17 00:00:00 2001 From: gohan5858 <88976739+gohan5858@users.noreply.github.com> Date: Sun, 27 Oct 2024 11:04:42 +0900 Subject: [PATCH] =?UTF-8?q?change:=20=E4=B8=8D=E8=A6=81=E3=81=AA`date`,=20?= =?UTF-8?q?`startTime`,`endTime`=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task_yell/src/app/home/page.tsx | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/task_yell/src/app/home/page.tsx b/task_yell/src/app/home/page.tsx index 16a701c..378f3d6 100644 --- a/task_yell/src/app/home/page.tsx +++ b/task_yell/src/app/home/page.tsx @@ -75,14 +75,11 @@ type Todo = { type Event = { id: number; title: string; + start: Date; + end: Date; description: string; - date: Date; - startTime: string; - endTime: string; category: Category; priority: Priority; - start: Date; - end: Date; location: string; invitees: string; isTask: boolean; @@ -104,14 +101,16 @@ function EventCreator({ onSave, onCancel, initialTitle = "", + targetDate, }: { onSave: (event: Event) => void; onCancel: () => void; initialTitle?: string; + targetDate: Date; }) { const [title, setTitle] = useState(initialTitle); const [description, setDescription] = useState(""); - const [date] = useState(new Date()); + const [selectedDate] = useState(targetDate); const [startTime] = useState("10:00"); const [endTime] = useState("11:00"); const [location, setLocation] = useState(""); @@ -122,18 +121,15 @@ function EventCreator({ const [isLocked, setIsLocked] = useState(false); const handleSave = () => { - if (date) { + if (targetDate) { const newEvent: Event = { id: Date.now(), title, + start: new Date(`${format(selectedDate, "yyyy-MM-dd")}T${startTime}`), + end: new Date(`${format(selectedDate, "yyyy-MM-dd")}T${endTime}`), description, - date, - startTime, - endTime, category, priority, - start: new Date(`${format(date, "yyyy-MM-dd")}T${startTime}`), - end: new Date(`${format(date, "yyyy-MM-dd")}T${endTime}`), location, invitees, isTask, @@ -148,7 +144,9 @@ function EventCreator({

- {format(date || new Date(), "yyyy年MM月dd日 (E)", { locale: ja })} + {format(targetDate || new Date(), "yyyy年MM月dd日 (E)", { + locale: ja, + })}

{Array.from({ length: 24 }).map((_, hour) => ( @@ -179,11 +177,11 @@ function EventCreator({
{isTask ? ( - + ) : (
- - + +
)} @@ -810,6 +808,7 @@ export default function Home() { setIsEventModalOpen(false); }} initialTitle={draggedStickyNote ? draggedStickyNote.title : ""} + targetDate={selectedDate} />