From c339d456e4fe4c4d82b0608f9d817da7a9153d3c Mon Sep 17 00:00:00 2001 From: Keith Smith Date: Sun, 1 Nov 2026 09:07:36 -0700 Subject: [PATCH] Show the date as well as the time on each stream row Rows only showed a time of day, leaving the date to the group header above. Each row now shows "Oct 31, 5:30 PM" in the viewer's local timezone, with the year added only for articles from a previous year. Co-Authored-By: Claude Sonnet 5.5 --- static/css/base.css | 1 + static/js/localize-times.js | 6 +++++- templates/reader/_article_row.html | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/static/css/base.css b/static/css/base.css index 1386ea5..c9707f1 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -559,6 +559,7 @@ form p { font-size: 0.8rem; color: var(--text-dim); flex: 0 0 auto; + white-space: nowrap; } .article-actions { diff --git a/static/js/localize-times.js b/static/js/localize-times.js index 0507a8b..4f59cdf 100644 --- a/static/js/localize-times.js +++ b/static/js/localize-times.js @@ -4,7 +4,7 @@ // instant plus a UTC-formatted fallback as their initial text, and this // reformats them using the browser's own timezone, client-side, so the // server never needs to know (or guess) where the viewer actually is. - var SHORT_OPTIONS = { hour: "numeric", minute: "2-digit" }; + var SHORT_OPTIONS = { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" }; var LONG_OPTIONS = { year: "numeric", month: "short", @@ -21,6 +21,10 @@ var date = new Date(iso); if (isNaN(date.getTime())) return; var options = el.dataset.localFormat === "short" ? SHORT_OPTIONS : LONG_OPTIONS; + if (options === SHORT_OPTIONS && date.getFullYear() !== new Date().getFullYear()) { + // Date-only rows from a previous year would otherwise be ambiguous. + options = Object.assign({ year: "numeric" }, SHORT_OPTIONS); + } try { el.textContent = date.toLocaleString(undefined, options); } catch (e) { diff --git a/templates/reader/_article_row.html b/templates/reader/_article_row.html index f5741f1..4a2358f 100644 --- a/templates/reader/_article_row.html +++ b/templates/reader/_article_row.html @@ -9,7 +9,7 @@ {{ article.title|default:"(untitled)" }} {% if article.published_at %} - + {% endif %}