From f96743588144d88b9d4fe2dc343fea56f082cdc5 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Thu, 21 May 2026 16:55:36 -0500 Subject: [PATCH] avoid daylight savings time rounding issue on number of days --- apply-interest.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apply-interest.js b/apply-interest.js index 4d9d3b8..50442a8 100644 --- a/apply-interest.js +++ b/apply-interest.js @@ -41,7 +41,9 @@ function daysInYear(year) { const lastDate = await getLastTransactionDate(account, cutoff); if (!lastDate) continue; - const daysPassed = Math.floor((interestTransactionDate - new Date(lastDate)) / 86400000); + const daysPassed = Math.round( + (interestTransactionDate.setHours(0, 0, 0, 0) - new Date(lastDate).setHours(0, 0, 0, 0)) / 86400000 + ); let period = 12; let numPeriods = 1