BillTracker/client
null a15f00c568 refactor(client): single source of truth for money formatting (IMP-CODE-01)
The client had ~15 hand-rolled currency formatters (local `fmt`/`money`/
`fmtFull`/`fmtDollars`/…) plus a canonical `fmt` in lib/utils used at ~190
sites — same rules copy-pasted, with inconsistent handling of negatives,
whole-dollar, cents vs dollars, and blank input.

Add client/lib/money.js as the one implementation:
  - formatUSD(dollars)      — "$1,234.56" (whole/dash options)
  - formatUSDWhole(dollars) — "$1,235"
  - formatCentsUSD(cents)   — from integer cents; signed "+/-" and dash options
Inputs are coerced so null/''/NaN never render as "$NaN", and -0 is
normalized so it never shows as "-$0.00".

lib/utils.fmt now delegates to formatUSD (byte-identical — the existing
utils.test.js fmt suite is the regression guard), and the 15 local
formatters delegate to money.js. No display currency formatting remains
outside money.js; the /100 conversions left behind are calculations
(form prefill), not display.

Tests: client/lib/money.test.js (13). Full client suite 46 pass; build clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 12:46:22 -05:00
..
components refactor(client): single source of truth for money formatting (IMP-CODE-01) 2026-07-03 12:46:22 -05:00
contexts theme correctness 2026-05-28 01:30:40 -05:00
hooks feat(settings): auto-save preferences with live save status (batch 0.39.0) 2026-06-12 02:08:42 -05:00
lib refactor(client): single source of truth for money formatting (IMP-CODE-01) 2026-07-03 12:46:22 -05:00
pages refactor(client): single source of truth for money formatting (IMP-CODE-01) 2026-07-03 12:46:22 -05:00
public/img refactor: component splits, PWA support, CommandPalette 2026-05-28 20:53:22 -05:00
App.jsx feat(banking): bank transactions ledger page with route, sidebar link, and API endpoint 2026-06-12 03:59:42 -05:00
api.js fix(qa): version check is opt-out-able (QA-B16-01) 2026-07-03 10:05:37 -05:00
index.css feat(settings): safe-to-spend toggle, move notifications from Profile to Settings, fix dark-mode readability 2026-06-12 01:52:48 -05:00
main.jsx v0.24.3: Session fixes, activity log corrections, UI polish 2026-05-11 13:39:48 -05:00