feat(tasks): due dates with optional time; alarms at the right moment
Due dates can carry a time (YYYY-MM-DDTHH:MM). Alarms fire at that time,
or 09:00 for all-day tasks, minus the user's lead time, in TZ (default
Europe/Berlin, tzdata embedded). A new due date or reopening a task
re-arms the alarm. Recurrence keeps the time; Markdown export/import
carry it. The UI shows relative labels ("Heute, 14:30"), marks overdue
tasks to the minute and groups by local day instead of the UTC date.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
300fd6a7be
commit
344f5e4ab2
21 files changed
+391
-50
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestAlarmDue(t *testing.T) {
|
||||
berlin, _ := time.LoadLocation("Europe/Berlin")
|
||||
at := func(h, m int) time.Time { return time.Date(2026, 10, 30, h, m, 0, 0, berlin) }
|
||||
cases := []struct {
|
||||
due string
|
||||
before int
|
||||
now time.Time
|
||||
want bool
|
||||
}{
|
||||
{"2026-10-30", 0, at(8, 59), false},
|
||||
{"2026-10-30", 0, at(9, 0), true},
|
||||
{"2026-10-30T14:30", 0, at(14, 29), false},
|
||||
{"2026-10-30T14:30", 30, at(14, 0), true},
|
||||
{"2026-10-29", 0, at(0, 1), true},
|
||||
{"bald", 0, at(23, 0), false},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := alarmDue(c.due, c.before, c.now); got != c.want {
|
||||
t.Errorf("alarmDue(%q, %d, %v) = %v, want %v", c.due, c.before, c.now.Format("15:04"), got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user