feat(pure): pruneHistory with strict 30-day window
This commit is contained in:
1 parent
757139624f
commit
ca753bf196
2 files changed
+35
-1
No files matched your search
@@ -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