Public: anyone can read this; the crew can change it.
Relative times render as <time> with the exact time in the title, with no layout shift #13986
Check · Review · Land · Live done — Landed and live in production.
Relative times that were still bare text now come out of the existing time() helper in src/web/ui.ts ( , exact UTC in the title).
shipped production is serving it deploy 8e1361f
7 earlier comments · 1 event
Two of the three failing tests asserted the old bare text; I updated them and pushed. The third passes when run on its own here, so I changed nothing for it.
The two fixes
test/danger-language.test.tsexpected the literalstarted 5m agoin the detach block.test/repo-behind-line.test.tsexpected the literalchecked 2h agoin the behind-upstream line.
Both now match the word followed by <time …>5m ago</time>. The tests were wrong, not the code: the pages show the same words inside a <time datetime title> element, which is what this pull intends.
The third failure
- "a fast-forward applies the previewed id…" is in
test/take-expect.test.tsand was red in shard 17 of the check run. - It touches no relative time, so I treat it as a timing flake.
- It passes here along with the other two (18 tests, 0 failures).
bun x tsc --noEmit and bun scripts/gate.ts are clean. I did not run the full suite.
To try it: open /settings/following. Each commit age is a <time> with its exact UTC on hover.
🤖 Generated with Claude Code
<!-- look-pages 9b0daf6a90bc --> Look pages for 9b0daf6, from the gate:
look pages (inferred): this pull changes src/web/pages/detach.ts, src/web/pages/following.ts, src/web/pages/fork-offers.ts and 10 more; the forge pictures / (src/web/scope.ts), /docs (src/web/scope.ts), /explore (src/web/scope.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The look-pages comment is the gate's automatic inference, not a change request, so I changed no code. I added an empty commit with a Looks: /settings/following line, which the gate lets override the inferred list.
The gate pictured 26+ pages because they all import src/web/scope.ts. The visible change is the same on each: a relative time now renders as a <time datetime title> element with its exact UTC on hover, and the words don't change. /settings/following is the clearest place to see it, so I named that one.
If you want more pages pictured, say which and I'll add them to the commit line. Nothing was re-run this round because no code changed.
🤖 Generated with Claude Code
The swap to the existing time() helper is right and the preview-visible pages now carry <time datetime title>. Two of the three issue boxes are not met, and a few relative times are still bare. Fix in one round:
- FIRST: replace the single-line source scan with a test that renders real pages (feed, a pull, an issue, plus /settings/following or /now) and asserts that every relative-time word (\d+[smhd] ago, just now, etc.) sits inside a <time datetime title>. The scan only sees html
...on one line, so a multi-line template slips past it; src/web/pages/upstream-follow.ts:155 (checkLine(c, timeAgo(c.at))) is a bare relative time today that the scan cannot see. - Reserve width for real: tabular-nums + nowrap does not stop a shift when '9m ago' becomes '10m ago' or 'just now' becomes '1m ago'. Give time[datetime] an inline-block with a min-width in ch (e.g. min-width: 7ch; text-align: start) or document why not, and drop the source-contains CSS test for a behaviour one.
- Drop the as-text CSS test and the createApp/createUser/createRepo setup in the fork-offers test: forkOffersCard only reads repo for a link; a minimal Repo literal is enough.
- Small: fork-offers.ts import order (put
timewith the other ../ imports); the new CSS comment is over 100 columns.
Design: no principle broken; no new component classes, no new accent. Both doors: markup-only, the 'No door' note is fair. Phone/desktop pictures and the preview were not a concern beyond the above. Next after this: convert the cards.ts string-valued rows where a time can carry markup.
All four points are addressed and pushed. The targeted tests pass, along with tsc and the gate. The diff touches 2,243 test files, so I did not run them all here; the forge's check will.
- Render test replaces the scan.
test/time-element.test.tsnow serves a real app and fetches/,/now/check,/amy/r, the repo's issues list and issue page, its pulls list and pull page,/amy/r/followingand/amy/r/settings. Per page, it strips every<time datetime title>…</time>and asserts that no\d+(s|m|h|d|mo|y) agoorjust nowis left.
- /settings/following does not exist, so I used /amy/r/following, which is where the following card renders. /now needs a stage, so I used /now/check.
- The bare time you named at upstream-follow.ts:155 is fixed: the history row's title is now time(c.at) followed by checkLine(c, ""). A separate test checks that the history's age is a <time>.
- I updated the regex in test/upstream-follow-history.test.ts to allow the <time> element. That test was wrong, not the code.
- Width.
time[datetime]is nowinline-block; min-width: 7ch; text-align: start, keeping tabular digits andnowrap. The comment is wrapped under 100 columns. I dropped the CSS-contains test. There is no layout engine in the tests, so layout is not asserted at all; say if you want a browser-based check added. - Fork-offers test. The
createApp/createUser/createReposetup is gone.forkOffersCardandrepoBasenow takePick<Repo, "ownerName" | "name">, so the test passes a two-field literal with no cast. - Import order.
timenow sits with the../imports infork-offers.ts.
Trade-off to check: inside running prose, as in "started 5m ago." in the detach block, the 7ch minimum can leave a small gap before the punctuation. I kept it because you asked for no shift.
Not done: the cards.ts string-valued rows, which you listed as the next step.
To try it: open /amy/r/following or /amy/r/settings. Each age is a <time> with its exact UTC on hover.
🤖 Generated with Claude Code
<!-- look-pages e69e07cdb79d --> Look pages for e69e07c, from the gate:
look pages (inferred): "Looks: /amy/r/settings" is not a page of app.looks in forge.json; this pull changes src/web/chrome.ts, src/web/pages/detach.ts, src/web/pages/following.ts and 11 more; the forge pictures / (src/web/chrome.ts), /docs (src/web/chrome.ts), /explore (src/web/chrome.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The look-pages complaint was about commit messages, not code. I fixed it with a new empty commit that has a valid Looks: line. No code or tests changed.
The previous head commit said Looks: /amy/r/settings. That path is not in app.looks in forge.json, so the gate fell back to inferring pages. An earlier commit named /settings/following, which isn't in the list either.
The new commit says Looks: /, because / is in app.looks and renders the chrome that carries relative times. I couldn't amend the old commit without a force push, so the new line sits on top of it.
I didn't run the tests, type check or gate for this push, since only a commit message changed.
I'm assuming the gate reads the override from the newest commit. If it wants one Looks: line per page, say so and I'll add /docs and /explore the same way.
<!-- look-pages 9faae9710b49 --> Look pages for 9faae97, from the gate:
look pages (named): this pull changes src/web/chrome.ts, src/web/pages/detach.ts, src/web/pages/following.ts; a commit names /
The gate accepted the Looks: / line from my last commit: it now reads the look pages as "named", with /. Nothing in that comment needs changing, so I made no new commit and pushed nothing.
I didn't run the tests, type check or gate, since nothing changed.
Earlier asks: render test over nine real pages replaces the source scan (met); width reserved with min-width 7ch (met); fork-offers test without a cast via Pick<Repo,...> (met); the bare time in the upstream history row at upstream-follow.ts is now a <time> (met); import order (met). Tests cover the helper, the pages and the history row.
Next two things: (1) 7ch is one short of "just now" (8 chars), so "just now" to "1m ago" still moves by a character, contrary to the CSS comment; use 8ch. (2) Inside prose ("started 5m ago.") the minimum leaves a small gap before punctuation; consider scoping the min-width to row meta/trail contexts. Neither blocks.
Relative times that were still bare text now come out of the existing
time()helper insrc/web/ui.ts(<time datetime title>, exact UTC in the title). They are on these pages and cards:/nowThe feed, pulls and issues already used the helper, so no change was needed there. I did not touch the plain-text callers (TUI, MCP, string-valued card rows,
agoWordsin sentences) because they cannot carry markup.Width is reserved with one rule in
src/web/style/base.ts:time[datetime]gets tabular digits and no wrapping. I did not add a fixedmin-width, because that would put gaps inside sentences. Nothing rewrites the text in place; live swaps ignore<time>text, so there is no reflow.test/time-element.test.tschecks the helper's output, that a fork offer's age is a<time>, that nohtmltemplate still interpolatestimeAgo/agoWordsoutside<time>, and that the CSS rule exists. It is a source scan oversrc/web, not a render of three live pages. The scan only sees single-line templates, so a multi-line one could slip past it.tsc,gate.ts --fixanddesign-lintare clean. 161 tests across 14 related files pass; the full suite is left to the forge's check.scripts/fast.tsjudged the diff too broad to name tests, so I picked those files by hand. The push hook demanded a "Try:" commit, so there is an empty one with that message.To try it, open
/settings/followingor/nowand hover a time to see the exact UTC.🤖 Generated with Claude Code
Closes #13974