diff --git a/src/services/TaskService.ts b/src/services/TaskService.ts index 533b325c2..ef36ff494 100644 --- a/src/services/TaskService.ts +++ b/src/services/TaskService.ts @@ -204,7 +204,10 @@ export class TaskService { } private getCompletionDateForTask(task: TaskInfo): string { - return task.occurrence_date || getCurrentDateString(); + // Record the real completion date, matching non-recurring task behavior. + // Which occurrence was fulfilled is tracked separately on the parent's + // complete_instances (see buildMaterializedOccurrenceCompletePlan). #2125 + return getCurrentDateString(); } /** diff --git a/tests/unit/services/task-occurrence-materialization.test.ts b/tests/unit/services/task-occurrence-materialization.test.ts index 36010db8c..31ece205c 100644 --- a/tests/unit/services/task-occurrence-materialization.test.ts +++ b/tests/unit/services/task-occurrence-materialization.test.ts @@ -437,9 +437,12 @@ describe("TaskService materialized occurrences", () => { await taskService.updateProperty(occurrence, "status", "done"); + // completedDate records when the user actually completed the occurrence + // (the mocked "today", 2025-01-01), while the parent's complete_instances + // keeps tracking WHICH occurrence was fulfilled (the occurrence date). expect(frontmatterByPath.get(occurrence.path)).toMatchObject({ status: "done", - completedDate: "2026-06-01", + completedDate: "2025-01-01", }); expect(frontmatterByPath.get(parent.path)).toMatchObject({ complete_instances: ["2026-06-01"],