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

Function createDueTaskEvent

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

Source from the content-addressed store, hash-verified

97}
98
99export function createDueTaskEvent(
100 task: TaskInfo,
101 context: CalendarTaskEventContext
102): CalendarTaskEvent | null {
103 if (!task.due) return null;
104
105 const hasTime = hasTimeComponent(task.due);
106 const startDate = task.due;
107
108 let endDate: string | undefined;
109 if (hasTime) {
110 const start = parseDateToLocal(startDate);
111 const end = new Date(start.getTime() + 30 * 60 * 1000);
112 endDate = format(end, "yyyy-MM-dd'T'HH:mm");
113 }
114
115 const borderColor = normalizeThemeColor(
116 context.getPriorityColor(task.priority),
117 "var(--color-orange)"
118 );
119 const textColor = isCssVariableColor(borderColor)
120 ? context.getThemeTextColor(true)
121 : borderColor;
122
123 return {
124 id: `due-${task.path}`,
125 title: task.title,
126 start: startDate,
127 end: endDate,
128 allDay: !hasTime,
129 backgroundColor: colorWithAlpha(borderColor, 0.15),
130 borderColor,
131 textColor,
132 editable: true,
133 extendedProps: {
134 taskInfo: task,
135 eventType: "due",
136 isCompleted: context.isCompletedStatus(task.status),
137 },
138 };
139}
140
141function isCalendarEventInVisibleRange(
142 event: CalendarTaskEvent,

Callers 2

createDueEventFunction · 0.90

Calls 8

hasTimeComponentFunction · 0.90
parseDateToLocalFunction · 0.90
normalizeThemeColorFunction · 0.90
isCssVariableColorFunction · 0.90
colorWithAlphaFunction · 0.90
getPriorityColorMethod · 0.80
getThemeTextColorMethod · 0.80
isCompletedStatusMethod · 0.65

Tested by

no test coverage detected