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

Function createScheduledTaskEvent

src/bases/calendarTaskEvents.ts:55–97  ·  view source on GitHub ↗
(
	task: TaskInfo,
	context: CalendarTaskEventContext
)

Source from the content-addressed store, hash-verified

53}
54
55export function createScheduledTaskEvent(
56 task: TaskInfo,
57 context: CalendarTaskEventContext
58): CalendarTaskEvent | null {
59 if (!task.scheduled) return null;
60
61 const hasTime = hasTimeComponent(task.scheduled);
62 const startDate = task.scheduled;
63
64 let endDate: string | undefined;
65 if (hasTime && task.timeEstimate) {
66 const start = parseDateToLocal(startDate);
67 const end = new Date(start.getTime() + task.timeEstimate * 60 * 1000);
68 endDate = format(end, "yyyy-MM-dd'T'HH:mm");
69 } else if (!hasTime) {
70 endDate = calculateAllDayEndDate(startDate, task.timeEstimate);
71 }
72
73 const borderColor = normalizeThemeColor(
74 context.getPriorityColor(task.priority),
75 "var(--color-accent)"
76 );
77 const textColor = isCssVariableColor(borderColor)
78 ? context.getThemeTextColor(true)
79 : borderColor;
80
81 return {
82 id: `scheduled-${task.path}`,
83 title: task.title,
84 start: startDate,
85 end: endDate,
86 allDay: !hasTime,
87 backgroundColor: "transparent",
88 borderColor,
89 textColor,
90 editable: true,
91 extendedProps: {
92 taskInfo: task,
93 eventType: "scheduled",
94 isCompleted: context.isCompletedStatus(task.status),
95 },
96 };
97}
98
99export function createDueTaskEvent(
100 task: TaskInfo,

Callers 2

createScheduledEventFunction · 0.90

Calls 8

hasTimeComponentFunction · 0.90
parseDateToLocalFunction · 0.90
normalizeThemeColorFunction · 0.90
isCssVariableColorFunction · 0.90
calculateAllDayEndDateFunction · 0.85
getPriorityColorMethod · 0.80
getThemeTextColorMethod · 0.80
isCompletedStatusMethod · 0.65

Tested by

no test coverage detected