MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / inferDailyTaskDueDates

Function inferDailyTaskDueDates

packages/shared-domain/src/tasks.ts:373–387  ·  view source on GitHub ↗
(
  tasks: VaultTask[],
  dueByPath: ReadonlyMap<string, string>
)

Source from the content-addressed store, hash-verified

371 * nothing changed (cheap to call from a memo).
372 */
373export function inferDailyTaskDueDates(
374 tasks: VaultTask[],
375 dueByPath: ReadonlyMap<string, string>
376): VaultTask[] {
377 if (dueByPath.size === 0) return tasks
378 let changed = false
379 const out = tasks.map((task) => {
380 if (task.due) return task
381 const iso = dueByPath.get(task.sourcePath)
382 if (!iso) return task
383 changed = true
384 return { ...task, due: iso, dueInferred: true }
385 })
386 return changed ? out : tasks
387}
388
389/** Bucket tasks by `due` ISO date. Done (checked) tasks are skipped; waiting
390 * tasks are kept so a `@waiting` task with a due date still appears on the

Callers 3

CalendarPanelFunction · 0.90
TasksViewFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected