diff --git a/.commitmessage b/.commitmessage index 5580a49..63fa622 100644 --- a/.commitmessage +++ b/.commitmessage @@ -1,4 +1,4 @@ -fix: show membership date for stores without pickups +fix: refresh invalid last pickup timestamps -Treat Foodsharing's zero lastFetch value as no pickup, store memberSince, and -show compact, visible mobile status information without hover tooltips. +Force an immediate member refresh for legacy epoch timestamps so they are +replaced by the correct no-pickup status without waiting for the weekly check. diff --git a/services/lastPickupInfo.js b/services/lastPickupInfo.js index e90977d..59ea86c 100644 --- a/services/lastPickupInfo.js +++ b/services/lastPickupInfo.js @@ -17,6 +17,10 @@ function getStaleLastPickupStoreIds(config = [], now = Date.now()) { if (!entry?.id || entry.hidden) { return false; } + const lastPickupAt = parseTimestamp(entry.lastPickupAt); + if (entry.lastPickupAt && (!lastPickupAt || lastPickupAt <= 0)) { + return true; + } const checkedAt = parseTimestamp(entry.lastPickupCheckedAt); return !checkedAt || now - checkedAt > LAST_PICKUP_INFO_MAX_AGE_MS; }) diff --git a/src/utils/lastPickupInfo.test.js b/src/utils/lastPickupInfo.test.js index bfded25..06acd66 100644 --- a/src/utils/lastPickupInfo.test.js +++ b/src/utils/lastPickupInfo.test.js @@ -12,10 +12,11 @@ describe('last pickup info', () => { { id: 'missing' }, { id: 'stale', lastPickupCheckedAt: '2026-07-29T11:59:59.000Z' }, { id: 'fresh', lastPickupCheckedAt: '2026-07-30T12:00:01.000Z' }, + { id: 'epoch', lastPickupAt: '1970-01-01T00:00:00.000Z', lastPickupCheckedAt: '2026-08-05T12:00:00.000Z' }, { id: 'hidden', hidden: true } ]; - expect(getStaleLastPickupStoreIds(config, now)).toEqual(['missing', 'stale']); + expect(getStaleLastPickupStoreIds(config, now)).toEqual(['missing', 'stale', 'epoch']); }); it('records a successful check independently from the pickup date', () => {