You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore(frontend): rename savings-history.ts's private formatCurrency to stop shadowing utils.ts's #171
frontend/src/modules/savings-history.ts:332 defines a private formatCurrency(value) that shadows the shared formatCurrency exported from frontend/src/utils.ts (imported and used elsewhere in the same codebase, including in savings-history.ts's siblings via dashboard.ts).
Found during review of PR LeanerCloud/cloud-commitments-cli#1732 (locale-pinning formatCurrency/getDateParts in utils.ts, issue LeanerCloud/cloud-commitments-cli#1728). This local copy is out of scope for that PR — it uses toFixed(), not toLocaleString(), so it isn't locale-dependent and isn't part of the LeanerCloud/cloud-commitments-cli#1728 bug. But it is a second, independently-maintained "format currency for charts" helper with different behavior (K-abbreviation above $1000) living under the same name as the shared helper. That's a duplication / naming-collision risk:
A future edit to the shared formatCurrency (e.g. another locale/format fix) won't propagate here, and nothing signals that this file has its own copy.
The identical name makes it easy for a future contributor to assume savings-history.ts uses the shared helper when it doesn't.
Suggested fix
Rename the local helper to something that doesn't collide with the shared name (e.g. formatChartCurrency or formatAbbreviatedCurrency), or evaluate whether the K-abbreviation behavior belongs as an option on the shared formatCurrency in utils.ts instead of a separate copy. Low risk, mechanical rename either way.
Scope
Frontend only, frontend/src/modules/savings-history.ts. No behavior change required — this is a naming/duplication cleanup, not a bug fix.
Activity
fix(frontend): pin getDateParts month abbreviation to en-US too
fix(frontend): pin formatCurrency to en-US instead of the host locale (…