From dbf8980f1bc5428d1eb463505968469617dbf3fc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 28 Feb 2026 09:59:06 +0200 Subject: refactor(task): centralize Taskwarrior date format as task.DateFormat DRY/MEDIUM task (UUID 2c74960f): the format string "20060102T150405Z" was hardcoded in 5+ places across the task and ui packages. - Export task.DateFormat constant from internal/task/task.go - Replace hardcoded string in task.go and stats.go with DateFormat - Update internal/ui/helpers.go to alias the constant (taskDateFormat = task.DateFormat) rather than repeating the string literal - Replace all 6 raw string literals in table.go with task.DateFormat - Remove duplicate dueText() from table.go; its only call site now uses formatDueText() from helpers.go, which also normalises to midnight UTC for more accurate day-difference calculations Co-Authored-By: Claude Sonnet 4.6 --- internal/task/stats.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/task/stats.go') diff --git a/internal/task/stats.go b/internal/task/stats.go index c516249..b306687 100644 --- a/internal/task/stats.go +++ b/internal/task/stats.go @@ -28,7 +28,7 @@ func DueTasks(tasks []Task, now time.Time) int { if t.Status == "completed" || t.Due == "" { continue } - ts, err := time.Parse("20060102T150405Z", t.Due) + ts, err := time.Parse(DateFormat, t.Due) if err != nil { continue } -- cgit v1.2.3