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

This commit is contained in:
dev
2026-06-01 15:42:37 -05:00
parent 757139624f
commit ca753bf196
2 changed files with 35 additions and 1 deletions
+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);
}