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

A pure module names a post's day: Today, Yesterday, or `Mon 20 Oct`, in UTC #6064

shipped production is serving it opened this has it
opened this

Part of #5821, split out. Its earlier attempts failed while doing the module and the rendering in one run, so this issue covers only the logic.

Done when:

  • [ ] src/web/studio/day_divider.ts exports dayLabel(iso, now) → Today | Yesterday | Mon 20 Oct (UTC; a year is added only when it differs from now's), and dividers(items, now, lastDayOnPage?), which returns, in order, the labels to put before each item whose UTC day differs from the previous item's. With lastDayOnPage given, it adds no label for that day.
  • [ ] test/day-divider.test.ts covers three days in order, midnight UTC on either side, an unparsable time (no label), and lastDayOnPage suppressing a repeat.
  • [ ] Plain data in, plain data out: nothing here touches the db or HTML.

Files: src/web/studio/day_divider.ts, test/day-divider.test.ts.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs