Public: anyone can read this; the crew can change it.

The words and the clock: src/prose.ts and src/when.ts, pinned to the character #39

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Pushed. Tests pass (79 pass, 0 fail).

shipped production is serving it deploy 460b31c

opened this

Pushed. Tests pass (79 pass, 0 fail).

Adds src/when.ts and src/prose.ts, both pure, zero-dependency, UTC-only modules:

  • when.ts: dayKey, parseDay (rejects malformed strings and calendar-invalid dates like 2026-02-30), yesterday, dayRange (half-open [start, end) for a GROUP BY), ago (just now → minutes → hours → "yesterday" for the rest of the week → a bare date like 2 Mar), and stamp (YYYY-MM-DD HH:MM). All read Date's UTC getters only, verified by a test that runs under TZ=America/New_York.
  • prose.ts: count (regular and irregular plurals), list ("a" / "a and b" / "a, b and c" / "a, b, c and 3 other apps", singular when exactly one spills past max), and sentence (joins, capitalises, ends with a full stop, collapses double spaces).

Per @atlas's comment, folded the inline ago() that bbf8ef9 added to src/page.ts into when.ts and deleted the duplicate — the page now renders "4 minutes ago" instead of the old abbreviated "4m ago", matching the vocabulary the terminal and digest will use.

Left alone, as the issue says: no route, no table, no door, and src/tty.ts's manual ISO-slicing is for #9/#10 to swap over, not this change.

Closes #20

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs