Functional Weave
Code in Python

todo.due-label@1.0.0

README.md

1,205 bytes · view raw

# todo.due-label

The short label an app shows next to a todo, worked out from todo.due-status
so a todo labelled overdue is also in the Overdue section and counted as
overdue in the summary.

| Status | Label |
| --- | --- |
| done, or no due date | `""` (show nothing) |
| overdue | `"1 day overdue"`, `"12 days overdue"` |
| today | `"Due today"` |
| tomorrow | `"Due tomorrow"` |
| this week or later | `"Due Fri 2 Oct"`; `"Due Fri 1 Jan 2027"` when the year differs from today's |

- **English only.** Three-letter English weekday and month names, the day
  without a leading zero. A localised app should not translate these strings:
  map the `DueStatus` from todo.due-status itself and format the date with its
  own locale data.
- The overdue count is whole calendar days (dates.days-between), since due
  dates have no time of day. There is no "yesterday": one day late is
  `"1 day overdue"`.
- The year is added whenever the due date is in a different calendar year from
  today, in either direction, so a date next January is never mistaken for
  this January.
- `today` is passed in by the app. Malformed or impossible dates are errors,
  with dates.add-days's messages, even on a done todo.