feat(pure): pruneHistory with strict 30-day window

This commit is contained in:
dev committed 2026-06-01 15:42:37 -05:00
1 parent 757139624f
commit ca753bf196
2 files changed
+35 -1

No files matched your search

+7
View File
@@ -50,3 +50,10 @@ export function computeEstimate(current, target, perTrain, perDay) {
return { remaining, trainsToGo, days, eta };
}
const THIRTY_DAYS_MS = 30 * MS_PER_DAY;
export function pruneHistory(entries, now = Date.now()) {
const cutoff = now - THIRTY_DAYS_MS;
return entries.filter((e) => e.ts > cutoff);
}