MCPcopy
hub / github.com/callumalpass/tasknotes / getTasksForDate

Method getTasksForDate

src/services/FilterService.ts:681–712  ·  view source on GitHub ↗

* Get tasks for a specific date within an agenda view * Handles recurring tasks, due dates, scheduled dates, and overdue logic

(
		date: Date,
		baseQuery: FilterQuery,
		includeOverdue = false
	)

Source from the content-addressed store, hash-verified

679 * Handles recurring tasks, due dates, scheduled dates, and overdue logic
680 */
681 async getTasksForDate(
682 date: Date,
683 baseQuery: FilterQuery,
684 includeOverdue = false
685 ): Promise<TaskInfo[]> {
686 // FIXED: Use UTC Anchor principle for consistent date handling
687 const dateStr = formatDateForStorage(date);
688 const isViewingToday = isTodayUtil(dateStr);
689
690 // Get all tasks and filter using new system
691 const allTaskPaths = this.cacheManager.getAllTaskPaths();
692 const allTasks = await this.pathsToTaskInfos(Array.from(allTaskPaths));
693 const filteredTasks = allTasks.filter((task) => this.evaluateFilterNode(baseQuery, task));
694 const hideCompletedFromOverdue = this.runtime?.settings?.hideCompletedFromOverdue ?? true;
695
696 const tasksForDate = filteredTasks.filter((task) =>
697 isTaskForAgendaDate(task, {
698 dateStr,
699 isViewingToday,
700 includeOverdue,
701 hideCompletedFromOverdue,
702 isCompletedStatus: (status) => this.statusManager.isCompletedStatus(status),
703 })
704 );
705
706 // Apply sorting to the filtered tasks for this date
707 return this.sortTasks(
708 tasksForDate,
709 baseQuery.sortKey || "due",
710 baseQuery.sortDirection || "asc"
711 );
712 }
713
714 /**
715 * Get overdue tasks for the agenda view

Callers 3

getAgendaDataMethod · 0.95

Calls 7

pathsToTaskInfosMethod · 0.95
evaluateFilterNodeMethod · 0.95
sortTasksMethod · 0.95
formatDateForStorageFunction · 0.90
isTaskForAgendaDateFunction · 0.90
getAllTaskPathsMethod · 0.65
isCompletedStatusMethod · 0.65

Tested by

no test coverage detected