fix: show minus sign for negative amounts in fmt#80
Merged
Conversation
fmt was stripping the sign via Math.abs, causing negative values to display as e.g. $50.00 instead of -$50.00 on the Trends page. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Dashboard, Tags, and Health were manually prepending '+'/'-' before calling fmt(). Now that fmt() includes the minus sign for negatives, these would produce '--$X' or '+-$X'. Switched to fmtSigned() or plain fmt() as appropriate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After fmt gained its own minus-sign prefix, fmtSigned('-' + fmt(n))
would produce '--$50.00' for negatives. Pass Math.abs(n) so the sign
comes only from fmtSigned's own prefix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- TUI Health net cash: fmt → fmtSigned to match GUI (show + for surplus) - TUI Health net worth: remove manual '-' prefix; fmtCompact already handles sign - TUI Trends search view: remove redundant Math.abs (fmt now handles negatives) - GUI NetWorth tooltip: remove redundant Math.abs for same reason Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fmt(-50) now returns '-$50.00' instead of '$50.00'. The networth test's getByText regex now matched balance <td>s too; scope it to <span> so it stays targeted at the bigNumber element. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fmt()was callingMath.abs(n)unconditionally, stripping the sign from negative values$50.00instead of-$50.00on the Trends page (tooltip + summary cards)n < 0 ? '-' : ''prefix before the$signTest plan
-$X.XXfmtSignedstill works correctly (e.g.-$X.XXfor negative,+$X.XXfor positive)fmtCompactY-axis labels are unaffected (has its own sign handling)🤖 Generated with Claude Code