From 320fd69b0abc74587c16fc4c78b9f0735ad0d94e Mon Sep 17 00:00:00 2001 From: Ian Paterson Date: Wed, 15 Nov 2023 10:17:39 -0500 Subject: [PATCH] Do not export future balances (#16) --- src/shared/lib/accounts.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/lib/accounts.ts b/src/shared/lib/accounts.ts index 553ef92..a05b8a9 100644 --- a/src/shared/lib/accounts.ts +++ b/src/shared/lib/accounts.ts @@ -147,7 +147,9 @@ const fetchDailyBalancesForMonthIntervals = async ({ type: 'CUSTOM', startDate: start.toISODate(), // end is really the start of the next month, so subtract one day - endDate: end.minus({ day: 1 }).toISODate(), + endDate: end < DateTime.now() + ? end.minus({ day: 1 }).toISODate() + : DateTime.now().toISODate(), }, overrideApiKey, })