Functional Weave
Code in TypeScript

todo.due-status@1.0.0

README.md

1,060 bytes · view raw

# todo.due-status

Where a todo stands against its due date today, as one of `done`, `overdue`,
`today`, `tomorrow`, `this-week`, `later` or `none` (no due date). todo.due-label,
todo.group-by-due and todo.summary are all built on it, so a todo is overdue
in exactly one way everywhere in an app.

- `done` wins: a finished todo is never overdue, whatever its date.
- `overdue` is a due date before today. Due dates have no time of day, so a
  todo due today is `today` until midnight, never overdue.
- `this-week` is after tomorrow and no later than Sunday of the current ISO
  week (weeks start on Monday). On Saturday tomorrow is Sunday, and on Sunday
  tomorrow is already next week, so on those days nothing is `this-week`:
  Monday's todos are `later`. That is the calendar meaning of "this week",
  not "the next seven days".

`today` is the user's local date, passed in by the app; this capability never
reads the clock. Malformed or impossible dates are errors (dates.add-days's
messages), checked even on a done todo so that bad data is found early.