( task: TaskInfo, context: CalendarTaskEventContext )
| 53 | } |
| 54 | |
| 55 | export 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 | |
| 99 | export function createDueTaskEvent( |
| 100 | task: TaskInfo, |
no test coverage detected