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

Function readTaskDates

e2e/issues/issue-1441-span-task-drag-broken.spec.ts:139–154  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

137}
138
139async function readTaskDates(page: Page): Promise<TaskDates> {
140 return page.evaluate(async (targetPath) => {
141 const obsidianApp = (window as any).app;
142 const file = obsidianApp?.vault?.getAbstractFileByPath?.(targetPath);
143 if (!file) {
144 throw new Error(`Could not read ${targetPath}`);
145 }
146 const content: string = await obsidianApp.vault.read(file);
147 const scheduled = content.match(/^scheduled:\s*(.+)$/m)?.[1]?.trim();
148 const due = content.match(/^due:\s*(.+)$/m)?.[1]?.trim();
149 if (!scheduled || !due) {
150 throw new Error(`Task dates missing in ${targetPath}`);
151 }
152 return { scheduled, due };
153 }, SPAN_TASK_RELATIVE_PATH);
154}
155
156function eventsForTask(page: Page, eventType: string): Locator {
157 return page

Calls 2

getAbstractFileByPathMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected