Skip to content

fix: formatting issue for negative tokens#1356

Merged
rohanchkrabrty merged 7 commits intomainfrom
fix/tokens-formatting
Feb 4, 2026
Merged

fix: formatting issue for negative tokens#1356
rohanchkrabrty merged 7 commits intomainfrom
fix/tokens-formatting

Conversation

@paanSinghCoder
Copy link
Contributor

@paanSinghCoder paanSinghCoder commented Jan 29, 2026

Screenshot 2026-01-29 at 4 49 52 PM

Summary

Issue:

  • Values like -595 were shown as -,595 because the minus sign was included in the length used for comma placement, so a comma was inserted after the sign.
  • Very big values loose accuracy as Number() is used.

Fix:

  • Use BigInt() to convert the string to a bigInt without loosing the accuracy.
  • Implement num.toLocaleString(); to format the number.
  • Get locale from frontier config. Defaults to undefined.

Test Plan

  • Manually tested on local
  • Build and type checking passes

@vercel
Copy link

vercel bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Feb 3, 2026 0:25am

@coveralls
Copy link

coveralls commented Jan 29, 2026

Pull Request Test Coverage Report for Build 21630079402

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 37.983%

Totals Coverage Status
Change from base Build 21623958951: 0.0%
Covered Lines: 15956
Relevant Lines: 42008

💛 - Coveralls

@paanSinghCoder paanSinghCoder self-assigned this Jan 29, 2026
@paanSinghCoder paanSinghCoder added Do not merge Label to indicate that the PR is not ready to be merged even though might be (or not) approvals. and removed Do not merge Label to indicate that the PR is not ready to be merged even though might be (or not) approvals. labels Jan 29, 2026
@rohilsurana rohilsurana requested a review from rsbh January 29, 2026 12:25
@paanSinghCoder paanSinghCoder marked this pull request as ready for review January 29, 2026 12:33
Copy link
Contributor

@rohanchkrabrty rohanchkrabrty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString

Let's use this to format the number.

const n = 34523453.345;
console.log(n.toLocaleString());    // "34,523,453.345"

@rohanchkrabrty rohanchkrabrty merged commit 01d07bd into main Feb 4, 2026
7 checks passed
@rohanchkrabrty rohanchkrabrty deleted the fix/tokens-formatting branch February 4, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants