Skip to content

fix: strip trailing .0 in formatCompactCurrency for cross-environment consistency - #671

Merged
hotlong merged 3 commits into
mainfrom
copilot/fix-ci-errors-test-build
Feb 21, 2026
Merged

fix: strip trailing .0 in formatCompactCurrency for cross-environment consistency#671
hotlong merged 3 commits into
mainfrom
copilot/fix-ci-errors-test-build

Conversation

Copilot AI commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

Intl.NumberFormat with notation: 'compact' produces $150.0K instead of $150K in certain Node.js/ICU versions, causing mobile-card-view.test.tsx to fail in CI.

  • Strip trailing .0 before compact suffixes (K/M/B/T) via regex post-processing, preserving meaningful decimals like $1.5M
const formatted = new Intl.NumberFormat('en-US', {
  style: 'currency', currency, notation: 'compact', maximumFractionDigits: 1,
}).format(value);
return formatted.replace(/\.0(?=[KMBT])/, '');
Original prompt

fix ci errors test and build


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Feb 21, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 21, 2026 2:58am
objectui-demo Ready Ready Preview, Comment Feb 21, 2026 2:58am
objectui-storybook Ready Ready Preview, Comment Feb 21, 2026 2:58am

Request Review

Copilot AI and others added 2 commits February 21, 2026 02:49
…environment output

Fixes CI test failure where Intl.NumberFormat produced "$150.0K" instead of "$150K"
in certain Node.js/ICU versions. The regex strips trailing ".0" before compact suffixes
(K/M/B/T) while preserving meaningful decimals like "$1.5M".

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI errors in test and build process fix: strip trailing .0 in formatCompactCurrency for cross-environment consistency Feb 21, 2026
Copilot AI requested a review from hotlong February 21, 2026 02:52
@hotlong
hotlong marked this pull request as ready for review February 21, 2026 03:43
Copilot AI review requested due to automatic review settings February 21, 2026 03:43
@hotlong
hotlong merged commit 74cbdf1 into main Feb 21, 2026
6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a cross-environment consistency issue in currency formatting where different Node.js/ICU versions produce inconsistent compact currency notation output (e.g., $150.0K vs $150K), causing mobile-card-view tests to fail in CI.

Changes:

  • Added regex post-processing to strip trailing .0 before compact suffixes (K/M/B/T) while preserving meaningful decimals like $1.5M

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.

3 participants