Functional Weave
Code in Rust

todo.group-by-due@1.0.0

README.md

1,223 bytes · view raw

# todo.group-by-due

Splits a todo list into the sections a planner shows, using todo.due-status
for every todo so the sections agree with the labels and the summary.

Sections always come in this order, and only those with at least one todo are
returned:

| status | title |
| --- | --- |
| overdue | Overdue |
| today | Today |
| tomorrow | Tomorrow |
| this-week | This week |
| later | Later |
| none | No date |
| done | Done |

- **Overdue, This week and Later are sorted by due date**, earliest first,
  because they span several dates. The sort is stable: todos with the same due
  date keep their input order.
- **Today, Tomorrow, No date and Done keep the input order**, since every todo
  in them has the same date (or none). So sort first by whatever you prefer
  (priority, manual order, title) and the grouping keeps it inside each
  section and among equal dates.
- The titles are English. A localised app maps `status` to its own strings.
- "This week" is the rest of the ISO week after tomorrow (see
  todo.due-status): on Saturday and Sunday there is no This week section.
- `today` is checked even for an empty list, and a malformed or impossible
  date anywhere is an error (dates.add-days's messages).