An item row's date is short and smaller (#508)

"Dec 3, 2026" at 15px took a third of a phone row and cut the title short.
Now the time today, "Nov 20" this year, "May 2025" before, at 13px; the
full date stays in the tooltip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RqkrVCCH8YcP2Y3i8VNYWA
This commit is contained in:
2026-12-03 12:38:43 -05:00
parent 3de955c52a
commit 1794a4c944
5 changed files with 23 additions and 2 deletions

View File

@@ -86,6 +86,15 @@ test('ago says how long since, and never for nothing', () => {
assert.match(run(`ago(${NOW - 90 * 86400})`), /2026/);
});
test('a row date is short: the time today, the day this year, the month before (#508)', () => {
const now = 'new Date(2026, 11, 3, 15, 0)';
assert.match(run(`rowDate(new Date(2026, 11, 3, 9, 36).getTime()/1000, ${now})`), /9:36/);
const day = run(`rowDate(new Date(2026, 10, 20).getTime()/1000, ${now})`);
assert.match(day, /20/); assert.doesNotMatch(day, /2026/);
assert.match(run(`rowDate(new Date(2025, 4, 2).getTime()/1000, ${now})`), /2025/);
assert.equal(run('rowDate(null)'), '');
});
test('due says how long until a feed is checked', () => {
assert.equal(run(`due(${NOW - 1})`), 'due now');
assert.equal(run(`due(${NOW + 10})`), 'in 1m');

View File

@@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- An item row's date is short and smaller: the time today, the day and month this year, the month and year before; the full date on hover (#508).
- A toolbar button that cannot act says why in its tooltip (Choose an item first, Open a feed to unsubscribe from it, Nothing to play in this item), and the admin page's Save says nothing has changed yet; on a phone a checkbox's row is 40 px to tap (#507).
- On a phone the toolbar's buttons and the list's tabs are at least 40 px to tap, a chapter no longer stays lit after a tap, and an item's pin and download buttons have names a screen reader reads, as the style guide's design half asks (#507).
- The page's words follow one style (docs/STYLE-GUIDE.md): failures say "Unable to …" and what to do, a podcast is a podcast rather than a show, a feed has an address rather than a URL, and the buttons Auto and Initials in a signal's icon picker read Pick for me and Use initials (#507).

View File

@@ -1580,7 +1580,8 @@ body:has(#player.on) #status{padding-bottom:3px}
.ep{padding:10px 8px;border-radius:10px;min-height:44px}
.ep.sel{border-color:var(--edge)}
.ep .t{font-size:17px}
.ep .line,.ep .date{font-size:15px}
.ep .line{font-size:15px}
.ep .date{font-size:13px}
.ep+.ep{background-image:linear-gradient(var(--line),var(--line));background-size:calc(100% - 8px) 1px;background-position:8px 0;background-repeat:no-repeat}
.ep.sel,.ep.sel+.ep{background-image:none}
.feed{padding:9px 10px;min-height:44px;border-radius:10px}

View File

@@ -219,7 +219,7 @@ function epEl(e: Entry){
${enc&&!has?`<div class="dlbar" data-bar="${enc.id}"><i></i></div>`:''}
</div>
<span class="size">${enc?mb(enc.length):''}</span>
<span class="date">${dateOf(e.published)}</span>
<span class="date" title="${dateOf(e.published)}">${rowDate(e.published)}</span>
<div class="rowacts">
${enc&&playsKind(enc)?queueButton(e):''}
${playable?`<button class="iconbtn" data-a="play" title="Play" aria-label="Play">${ICON.play}</button>`:

View File

@@ -309,6 +309,16 @@ const ago = (t: number|null) => {
// One formatter: toLocaleDateString with options makes a new one each call, every row of a list.
const DATE_FMT = new Intl.DateTimeFormat(undefined,{month:'short',day:'numeric',year:'numeric'});
const dateOf = (t: number|null) => t?DATE_FMT.format(t*1000):'';
// A row's date is short (#508): the time today, the day this year, the month before that.
const TIME_FMT = new Intl.DateTimeFormat(undefined,{hour:'numeric',minute:'2-digit'});
const DAY_FMT = new Intl.DateTimeFormat(undefined,{month:'short',day:'numeric'});
const MONTH_FMT = new Intl.DateTimeFormat(undefined,{month:'short',year:'numeric'});
const rowDate = (t: number|null, now=new Date()) => {
if(!t) return '';
const d=new Date(t*1000);
if(d.toDateString()===now.toDateString()) return TIME_FMT.format(d);
return (d.getFullYear()===now.getFullYear()?DAY_FMT:MONTH_FMT).format(d);
};
// A podcast episode is tens of MB, an article's image a few KB: whole MB made the small ones "0 MB".
const mb = (n: number|null) => !n?'' : n<1048576?Math.max(1,Math.round(n/1024))+' KB'
: n<1073741824?Math.round(n/1048576)+' MB' : (n/1073741824).toFixed(1)+' GB';