( task: TaskInfo, context: CalendarTaskEventContext )
| 97 | } |
| 98 | |
| 99 | export 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 | |
| 141 | function isCalendarEventInVisibleRange( |
| 142 | event: CalendarTaskEvent, |
no test coverage detected