From c39361726fa9cf1623d49ea1b9b2dd7e43f67622 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 14 Nov 2026 11:27:41 +0100 Subject: feat(calendar): list due tasks from a task vdir beside the events The sampler reads open VTODOs with a due date from ~/.local/share/tasks//*.ics (a vdirsyncer filesystem storage, override with UDT_TASKS_DIR) and writes them to the cache as ISO 'task' lines. The card merges them into the week's rows by date, with a checkbox before the title and an urgency colour: overdue critical, due today warning, later label. Overdue tasks stay until done, so they lead the table. Tasks never mark the month grid. Co-Authored-By: Claude Opus 5.5 --- test/test_data.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/test_data.lua') diff --git a/test/test_data.lua b/test/test_data.lua index c33e5ae..9612c43 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -117,6 +117,22 @@ assert(#up == 2 and up[2].d == 25, 'eight days from the 18th end on the 25th') assert(#data.calendar_upcoming({ { y = 2026, m = 11, d = 2 } }, { 2026, 10, 28 }, 8) == 1, 'week crosses into next month') +-- Tasks: separate from events so the grid stays appointments-only, merged +-- with them by date for the table. An overdue task is kept (it sorts first), +-- one past the week is cut like an event, and an all-day row sorts before a +-- timed one on the same day, as khal orders them. +assert(#cal.tasks == 3, 'task count, got ' .. tostring(#cal.tasks)) +assert(cal.tasks[1].task and cal.tasks[1].start == nil + and cal.tasks[2].start == '17:00', 'task fields') +local ag = data.calendar_agenda(cal, { 2026, 9, 18 }, 8) +local titles = {} +for i, e in ipairs(ag) do titles[i] = e.title end +assert(table.concat(titles, ',') == 'Overdue chore,A birthday,Dentist,' + .. 'Task due today,Team sync | notes', + 'agenda order, got ' .. table.concat(titles, ',')) +assert(#data.calendar_agenda(empty, { 2026, 9, 18 }, 8) == 0, + 'no events, no tasks: empty agenda') + -- month_shape: September 2026 has 30 days and starts on a Tuesday. -- Monday = 1, so Tuesday = 2. local ndays, first = data.month_shape(2026, 9) -- cgit v1.2.3