feat(nvim): do/late date chip (+ ↻) on task-view rows (§8)
Some checks failed
Build / validate (pull_request) Failing after 1m17s

`:Heph next`/`list` rows now render a compact relative do/late date chip
(today/tomorrow/yesterday/MM-DD/YYYY-MM-DD, mirroring heph-tui's fmt) and
a recurrence ↻, so scheduling is visible at a glance. `<CR>` already jumps
to a row's canonical-context doc. e2e: a do-date-chip render assertion.

Completes the §14 item-2 task-list UX wave.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-06-03 11:05:02 -07:00
commit 9d84eb7427
5 changed files with 56 additions and 5 deletions

View file

@ -17,9 +17,46 @@ local HINT = " <CR> open a add d done r refresh"
local ATTENTIONS = { "white", "orange", "red", "blue" }
-- Compact relative date for a do/late epoch-ms value (mirrors heph-tui's fmt):
-- today / tomorrow / yesterday, MM-DD within the year, else YYYY-MM-DD.
local function fmt_date(ms)
local d = os.date("*t", math.floor(ms / 1000))
local n = os.date("*t")
local d_noon = os.time({ year = d.year, month = d.month, day = d.day, hour = 12 })
local n_noon = os.time({ year = n.year, month = n.month, day = n.day, hour = 12 })
local days = math.floor((d_noon - n_noon) / 86400 + 0.5)
if days == 0 then
return "today"
elseif days == 1 then
return "tomorrow"
elseif days == -1 then
return "yesterday"
elseif d.year == n.year then
return string.format("%02d-%02d", d.month, d.day)
else
return string.format("%04d-%02d-%02d", d.year, d.month, d.day)
end
end
-- The right-side date chip: a late marker once past due, else the do-date.
local function date_chip(t)
if t.late_on and os.time() * 1000 > t.late_on then
return "late:" .. fmt_date(t.late_on)
elseif t.do_date then
return "do:" .. fmt_date(t.do_date)
end
return ""
end
local function row(t)
local tag = t.attention and ("[" .. t.attention .. "]") or "[ ]"
return string.format("%s %s", tag, t.title)
local recur = t.recurrence and "" or ""
local left = string.format("%s %s%s", tag, t.title, recur)
local chip = date_chip(t)
if chip ~= "" then
return string.format("%-50s %s", left, chip)
end
return left
end
local function task_on_line(buf)