feat(ui): relative message timestamps (LC-314) #334
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-314-relative-timestamps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Message and thread-reply times render as compact relative ("now", "2 minutes ago", "yesterday"), update live, and show the exact time on hover.
Changes
server/src/views/room.rs:MessageView::created_at_iso()(+ freeto_iso_utchelper, unit-tested) converts the stored timestamp to a JS-safe RFC3339 UTC string; handles both SQLiteYYYY-MM-DD HH:MM:SSand already-RFC3339 input.room/message.html(system + normal rows) androom/thread_reply_inner.html: timestamp wrapped in<time data-lc-ts datetime=... title=<absolute>>(absolute stays as title + no-JS fallback text).layout.html: formatter IIFE -Intl.RelativeTimeFormat(browser-localized; no new Fluent strings) for now/min/hour/day, absolute-date fallback past ~26 days; re-renders on htmx settle / OOB swap and every 30s.server/tests/fixtures/lc77_*: regenerated for the additive<time>wrapper (verified additive-only).Testing
just check,just fmt,just test,just test-saasall pass.to_iso_utcunit tests (SQLite format + pass-through). LC-77 fixtures updated + passing.Not operator-visible (no env/config/contract change).
Message and thread-reply times now read as compact relative ("now", "2 minutes ago", "yesterday"), update live, and show the exact time on hover. `MessageView::created_at_iso()` emits a JS-safe RFC3339 UTC string for a new `<time data-lc-ts datetime=... title=<absolute>>` wrapper at the three chat-reading timestamp sites (message row, system row, thread reply). A small formatter in layout.html renders each `[data-lc-ts]` via `Intl.RelativeTimeFormat` (browser-localized, so no new Fluent strings), falling back to an absolute date past ~26 days, and re-renders on htmx settle / OOB swap and every 30s so "2m" ticks up and a live arrival formats immediately. The absolute time stays in the title and is the no-JS fallback text. The LC-77 render fixtures were regenerated for the additive `<time>` wrapper (verified additive-only). `created_at_iso` handles both the SQLite "YYYY-MM-DD HH:MM:SS" UTC format and already-RFC3339 input. #LC-314 #LC-315 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>