Money tracker: Knab CSV import, multi-bank linking, sum reconcile, history range
Some checks failed
Deploy production / deploy (push) Failing after 23s
Some checks failed
Deploy production / deploy (push) Failing after 23s
- Knab statement exports: per-account ids (knab:<account>:<Referentie>), routed by IBAN, transfers between own accounts merged into one tracker account are dropped (interest kept) - Import: multiple files, hand-entered twins get the import id, hand entries equal to the sum of 2-3 payments within a day are replaced by them - bank-link --bank revolut|abn|knab with per-bank default account; ASPSP notes printed - bank-sync: longest history on an account first sync (--full to force), sum reconcile, per-session status so one bank failing does not mark the others - Timeline: 1 year / 3 years / All history range
This commit is contained in:
@@ -306,3 +306,28 @@ export function utilityEstimate(
|
||||
differenceCents: advancesCents - estimatedCents
|
||||
};
|
||||
}
|
||||
|
||||
export type HistoryRange = '1y' | '3y' | 'all';
|
||||
|
||||
/** First date shown for a history range (null = everything). */
|
||||
export function historyStart(range: HistoryRange, today: string): string | null {
|
||||
if (range === 'all') return null;
|
||||
const years = range === '1y' ? 1 : 3;
|
||||
return `${Number(today.slice(0, 4)) - years}${today.slice(4)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides history before `from`, starting each line at `from` with the balance it had then,
|
||||
* so a long bank history doesn't squash the recent months.
|
||||
*/
|
||||
export function clipSeries(series: ChartSeries[], from: string | null): ChartSeries[] {
|
||||
if (!from) return series;
|
||||
return series.map((line) => {
|
||||
const before = line.points.filter((point) => point.date < from);
|
||||
const after = line.points.filter((point) => point.date >= from);
|
||||
const carried = before.at(-1);
|
||||
const points =
|
||||
carried && after[0]?.date !== from ? [{ date: from, value: carried.value }, ...after] : after;
|
||||
return { ...line, points };
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user