Skip to content

Commit 74cbdf1

Browse files
authored
Merge pull request #671 from objectstack-ai/copilot/fix-ci-errors-test-build
2 parents 7f6d79f + 80a936b commit 74cbdf1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/fields/src/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,15 @@ export function formatCurrency(value: number, currency: string = 'USD'): string
8080
*/
8181
export function formatCompactCurrency(value: number, currency: string = 'USD'): string {
8282
try {
83-
return new Intl.NumberFormat('en-US', {
83+
const formatted = new Intl.NumberFormat('en-US', {
8484
style: 'currency',
8585
currency,
8686
notation: 'compact',
8787
maximumFractionDigits: 1,
8888
}).format(value);
89+
// Strip trailing ".0" before compact suffix for consistent cross-environment output
90+
// e.g. "$150.0K" → "$150K" while keeping "$1.5M" intact
91+
return formatted.replace(/\.0(?=[KMBT])/, '');
8992
} catch {
9093
return `${currency} ${value}`;
9194
}

0 commit comments

Comments
 (0)