Show ages on the AS and prefix pages in words (closes #163) #171

Merged
clawbot merged 1 commits from issue-163-ages-in-words into next 2026-10-27 01:23:51 +01:00
Collaborator

Fixes #163.

The Age column on the AS and prefix pages printed Go's duration format for every plural age, such as "360h0m0s ago". The templates now register humanize.Time from go-humanize as the timeSince function, and the hand-written function is gone. The page templates are unchanged.

What the diff does not show:

  • The test is with the server's handler tests. It stores routes in a test database and reads the AS page and the prefix pages, as the other page tests there do.
  • humanize.Time writes a time ahead of the server's clock as "N seconds from now". A route's time comes from the collector, so a collector whose clock runs ahead would show that. The old function said "just now".

Disclosures:

  • Judgement call: an age under a minute reads "now" or "N seconds ago" instead of "just now". Both are plain words, so I kept no special case and registered humanize.Time directly.
  • Behaviour change: an age over 30 days used to read as a date. It now reads "1 month ago" or "2 years ago". The Last Updated column beside it still gives the date.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/routewatch/issues/163. The Age column on the AS and prefix pages printed Go's duration format for every plural age, such as "360h0m0s ago". The templates now register `humanize.Time` from `go-humanize` as the `timeSince` function, and the hand-written function is gone. The page templates are unchanged. What the diff does not show: - The test is with the server's handler tests. It stores routes in a test database and reads the AS page and the prefix pages, as the other page tests there do. - `humanize.Time` writes a time ahead of the server's clock as "N seconds from now". A route's time comes from the collector, so a collector whose clock runs ahead would show that. The old function said "just now". Disclosures: - Judgement call: an age under a minute reads "now" or "N seconds ago" instead of "just now". Both are plain words, so I kept no special case and registered `humanize.Time` directly. - Behaviour change: an age over 30 days used to read as a date. It now reads "1 month ago" or "2 years ago". The Last Updated column beside it still gives the date. Model: opus-5-5
clawbot added the needs-review label 2026-10-27 01:15:57 +01:00
clawbot self-assigned this 2026-10-27 01:15:57 +01:00
clawbot added 1 commit 2026-10-27 01:15:58 +01:00
The Age column printed Go's duration format for every plural age, such
as "5m0s ago" or "360h0m0s ago".

The templates now register humanize.Time from go-humanize, which the
server already uses, as the timeSince function, and the hand-written
function is gone. Ages read "5 minutes ago", "3 hours ago" or "2 weeks
ago". An age under a minute reads "now" or in seconds instead of "just
now". An age over a month reads in months or years instead of a date.

Model: opus-5-5
Author
Collaborator

PASS: the AS and prefix pages now give ages in words through humanize.Time, which meets the definition of done in #163, and the new test fails on the code before the change.

Model: opus-5-5

PASS: the AS and prefix pages now give ages in words through `humanize.Time`, which meets the definition of done in https://git.eeqj.de/sneak/routewatch/issues/163, and the new test fails on the code before the change. Model: opus-5-5
clawbot merged commit 86e1f20e11 into next 2026-10-27 01:23:51 +01:00
clawbot deleted branch issue-163-ages-in-words 2026-10-27 01:23:52 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#171