Skip to content

Cash Flow tiles ignore the date filter; the "(current month)" hint is suppressed exactly when needed #145

Description

@KenTaniguchi-R

On the Cash Flow tab, with the filter chip reading Last 3 months:

  • Total Income — $0.00
  • Recurring Bills — $458.79
  • Spent So Far — $0.00
  • Safe to Spend — -$458.79

The Income vs Expense tab reports $33,185.24 income for the same range.

Cause

getSafeToSpend (src/queries/reports.ts:518) takes no filter argument at all and hardcodes the current calendar month:

const { from: dateFrom, to: dateTo } = monthBounds(getCurrentMonth());  // :524

page.tsx calls it as getSafeToSpend(householdId, tx) — the user's selected range never reaches it. Today is Sep 2, so September is nearly empty and three of the four tiles read ~$0.

The disclaimer is suppressed exactly when it is needed

There is a guard, but it is inverted in effect:

secondaryLabel: isCurrentMonth ? undefined : "(current month)"   // report-cash-flow.tsx:47

and isCurrentMonth is true whenever the range merely overlaps the current month:

const isCurrentMonth = dateFrom <= `${currentMonth}-01` && dateTo >= `${currentMonth}-01`;  // page.tsx:110

"Last 3 months" (Jun 2 – Sep 2) overlaps September, so isCurrentMonth is true and the hint is hidden — in precisely the case where a user sees $0.00 under a 3-month filter and has no way to know why. It also only ever decorates the Safe to Spend tile; the other three are equally current-month-only and carry no marker.

Proposal

Either pass the selected range through to getSafeToSpend, or label the whole tile group as a fixed current-month panel ("September 2026") independent of the filter. Also add an explanation of what Safe to Spend means — an unexplained negative number in red is alarming on first load.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: uiFrontend / UI componentsbugSomething isn't workingpriority: highSignificant impact

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions