Skip to content

Commit 792e31f

Browse files
committed
fix: Task date/time update not saving
- Added due parameter to updateTask in useTasks hook - Fixed handleTaskUpdate in TaskListCard to pass due date - Service already handled due date correctly Now editing a task's date/time persists properly
1 parent 58e6478 commit 792e31f

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/components/tasks/TaskListCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ export default function TaskListCard({
188188
};
189189

190190
const handleTaskUpdate = async (task: AppTask, title: string, notes?: string, due?: Date) => {
191-
await updateTask(taskList.id, task.id, title, notes);
192-
// Note: due date handling would need updateTask to be extended
191+
await updateTask(taskList.id, task.id, title, notes, due);
193192
};
194193

195194
const handleAddSubtask = async (task: AppTask, title: string) => {

src/hooks/useTasks.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,14 @@ export function useTasks() {
343343
}, [service, taskLists, updateTaskInState, setToast]);
344344

345345
/**
346-
* Update a task's title and/or notes
346+
* Update a task's title, notes, and/or due date
347347
*/
348348
const updateTask = useCallback(async (
349349
listId: string,
350350
taskId: string,
351351
title: string,
352-
notes?: string
352+
notes?: string,
353+
due?: Date
353354
): Promise<boolean> => {
354355
if (!service) return false;
355356

@@ -358,10 +359,11 @@ export function useTasks() {
358359
...task,
359360
title,
360361
notes: notes ?? task.notes,
362+
due: due ? due.toISOString() : task.due,
361363
}));
362364

363365
try {
364-
await service.updateTask({ listId, id: taskId, title, notes });
366+
await service.updateTask({ listId, id: taskId, title, notes, due });
365367
return true;
366368
} catch (err) {
367369
// Revert would need original values - for simplicity, just show error

0 commit comments

Comments
 (0)