From 853bbcf268537bd9d5ff1f4d03a5407729cb3bb5 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Tue, 20 Jan 2026 16:10:16 +0100 Subject: [PATCH] fix(reminders): clear scheduled time when adding to today from dialog When user clicks "Add to Today" in the reminder dialog, the task's scheduled time is now always cleared, even if it was originally scheduled for a specific time today (e.g., "2:30 PM today"). This ensures tasks become "sometime today" without a specific hour when added from the reminder dialog, while preserving the existing behavior for other flows (context menu, drag-drop). - Add isClearScheduledTime parameter to planTasksForToday action - Update reminder dialog to pass isClearScheduledTime: true - Update meta-reducer logic to clear dueWithTime when flag is set --- .../dialog-view-task-reminders.component.ts | 2 ++ .../task-shared-scheduling.reducer.ts | 16 +++++++++++----- src/app/root-store/meta/task-shared.actions.ts | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/features/tasks/dialog-view-task-reminders/dialog-view-task-reminders.component.ts b/src/app/features/tasks/dialog-view-task-reminders/dialog-view-task-reminders.component.ts index 38c349267..ebc7ceee7 100644 --- a/src/app/features/tasks/dialog-view-task-reminders/dialog-view-task-reminders.component.ts +++ b/src/app/features/tasks/dialog-view-task-reminders/dialog-view-task-reminders.component.ts @@ -144,6 +144,7 @@ export class DialogViewTaskRemindersComponent implements OnDestroy { parentTaskMap: { [task.id]: task.parentId, }, + isClearScheduledTime: true, }), ); this._removeTaskFromList(task.id); @@ -261,6 +262,7 @@ export class DialogViewTaskRemindersComponent implements OnDestroy { return { ...acc, [next.id as string]: next.parentId }; }, {}), isShowSnack: true, + isClearScheduledTime: true, }), ); diff --git a/src/app/root-store/meta/task-shared-meta-reducers/task-shared-scheduling.reducer.ts b/src/app/root-store/meta/task-shared-meta-reducers/task-shared-scheduling.reducer.ts index 974da5fd2..638e6b951 100644 --- a/src/app/root-store/meta/task-shared-meta-reducers/task-shared-scheduling.reducer.ts +++ b/src/app/root-store/meta/task-shared-meta-reducers/task-shared-scheduling.reducer.ts @@ -161,6 +161,7 @@ const handlePlanTasksForToday = ( state: RootState, taskIds: string[], parentTaskMap: Record, + isClearScheduledTime?: boolean, ): RootState => { const todayTag = getTag(state, TODAY_TAG.id); const today = getDbDateStr(); @@ -194,7 +195,10 @@ const handlePlanTasksForToday = ( // Preserve dueWithTime if it matches today's date // Only clear it if the task has a time scheduled for a different day - const shouldClearTime = task?.dueWithTime && !isToday(task.dueWithTime); + // However, if isClearScheduledTime is true (from reminder dialog), always clear the time + const shouldClearTime = isClearScheduledTime + ? !!task?.dueWithTime + : task?.dueWithTime && !isToday(task.dueWithTime); return { id: taskId, @@ -303,10 +307,12 @@ const createActionHandlers = (state: RootState, action: Action): ActionHandlerMa return handleDismissReminderOnly(state, id); }, [TaskSharedActions.planTasksForToday.type]: () => { - const { taskIds, parentTaskMap = {} } = action as ReturnType< - typeof TaskSharedActions.planTasksForToday - >; - return handlePlanTasksForToday(state, taskIds, parentTaskMap); + const { + taskIds, + parentTaskMap = {}, + isClearScheduledTime, + } = action as ReturnType; + return handlePlanTasksForToday(state, taskIds, parentTaskMap, isClearScheduledTime); }, [TaskSharedActions.removeTasksFromTodayTag.type]: () => { const { taskIds } = action as ReturnType< diff --git a/src/app/root-store/meta/task-shared.actions.ts b/src/app/root-store/meta/task-shared.actions.ts index 6b8069305..3456403c6 100644 --- a/src/app/root-store/meta/task-shared.actions.ts +++ b/src/app/root-store/meta/task-shared.actions.ts @@ -232,6 +232,7 @@ export const TaskSharedActions = createActionGroup({ parentTaskMap?: { [taskId: string]: string | undefined }; isShowSnack?: boolean; isSkipRemoveReminder?: boolean; + isClearScheduledTime?: boolean; }) => ({ ...taskProps, meta: {