MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / toggleRecurringTaskComplete

Method toggleRecurringTaskComplete

src/main.ts:1124–1149  ·  view source on GitHub ↗

* Toggles a recurring task's completion status for the selected date

(task: TaskInfo, date?: Date)

Source from the content-addressed store, hash-verified

1122 * Toggles a recurring task's completion status for the selected date
1123 */
1124 async toggleRecurringTaskComplete(task: TaskInfo, date?: Date): Promise<TaskInfo> {
1125 try {
1126 const targetDate = await this.taskService.resolveRecurringTaskActionDate(task, date);
1127 const updatedTask = await this.taskService.toggleRecurringTaskComplete(
1128 task,
1129 targetDate
1130 );
1131
1132 const dateStr = formatDateForStorage(targetDate);
1133 const wasCompleted = updatedTask.complete_instances?.includes(dateStr);
1134 const action = wasCompleted ? "completed" : "marked incomplete";
1135
1136 // Format date for display: convert UTC-anchored date back to local display
1137 const displayDate = parseDateToLocal(dateStr);
1138 new Notice(`Recurring task ${action} for ${format(displayDate, "MMM d")}`);
1139 return updatedTask;
1140 } catch (error) {
1141 tasknotesLogger.error("Failed to toggle recurring task completion:", {
1142 category: "persistence",
1143 operation: "toggle-recurring-task-completion",
1144 error: error,
1145 });
1146 new Notice("Failed to update recurring task");
1147 throw error;
1148 }
1149 }
1150
1151 async toggleTaskArchive(task: TaskInfo): Promise<TaskInfo> {
1152 try {

Calls 4

formatDateForStorageFunction · 0.90
parseDateToLocalFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected