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 %}