Skip to content

Commit e8c2b02

Browse files
Show year on list dates outside the current calendar year.
Include the year in absDate when the tweet is from another year; add a full-date tooltip on row timestamps. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 9ea42f8 commit e8c2b02

5 files changed

Lines changed: 13 additions & 6 deletions

File tree

feed-core.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,15 @@
171171
};
172172
}
173173

174-
function absDate(iso) {
174+
function absDate(iso, now = new Date()) {
175175
const d = new Date(iso);
176176
if (Number.isNaN(d.getTime())) return "";
177-
return `${MON[d.getMonth()]} ${d.getDate()}`;
177+
const nowD = now instanceof Date ? now : new Date(now);
178+
const label = `${MON[d.getMonth()]} ${d.getDate()}`;
179+
if (!Number.isNaN(nowD.getTime()) && d.getFullYear() !== nowD.getFullYear()) {
180+
return `${label}, ${d.getFullYear()}`;
181+
}
182+
return label;
178183
}
179184

180185
function relativeDate(iso, now = new Date()) {
@@ -189,7 +194,7 @@
189194
if (h < 24) return `${h}h`;
190195
const d = Math.floor(h / 24);
191196
if (d < 7) return `${d}d`;
192-
return absDate(iso);
197+
return absDate(iso, now);
193198
}
194199

195200
function fullDate(iso) {

feed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function rowHTML(t, i) {
225225
</div>
226226
</div>
227227
</div>
228-
<div class="when">${Core.relativeDate(t.date, appNow())}</div>
228+
<div class="when" title="${Core.escapeHTML(Core.fullDate(t.date))}">${Core.relativeDate(t.date, appNow())}</div>
229229
</div>`;
230230
}
231231

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "X Likes Search",
4-
"version": "0.4.4",
4+
"version": "0.4.5",
55
"description": "Index your X (Twitter) likes locally via GraphQL capture-and-replay, then browse them in an X-styled feed with instant keyword search.",
66
"permissions": ["storage", "activeTab", "scripting", "tabs"],
77
"host_permissions": ["https://x.com/*", "https://twitter.com/*"],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "x-likes-search",
3-
"version": "0.4.4",
3+
"version": "0.4.5",
44
"private": true,
55
"type": "commonjs",
66
"scripts": {

tests/unit/feed-core.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,6 @@ test("relative dates are stable when now is fixed", () => {
113113
assert.equal(Core.relativeDate("2026-06-03T10:00:00Z", now), "2h");
114114
assert.equal(Core.relativeDate("2026-06-01T12:00:00Z", now), "2d");
115115
assert.equal(Core.relativeDate("2026-05-20T12:00:00Z", now), "May 20");
116+
assert.equal(Core.relativeDate("2025-05-20T12:00:00Z", now), "May 20, 2025");
117+
assert.equal(Core.relativeDate("2024-06-01T12:00:00Z", now), "Jun 1, 2024");
116118
});

0 commit comments

Comments
 (0)