feat(pure): pruneHistory with strict 30-day window
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user