Skip to content

Commit 80a936b

Browse files
Copilothotlong
andcommitted
refine regex to only strip .0 before compact suffixes (K/M/B/T)
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 1ac8a66 commit 80a936b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/fields/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function formatCompactCurrency(value: number, currency: string = 'USD'):
8888
}).format(value);
8989
// Strip trailing ".0" before compact suffix for consistent cross-environment output
9090
// e.g. "$150.0K" → "$150K" while keeping "$1.5M" intact
91-
return formatted.replace(/\.0(?=[KMBT]|$)/, '');
91+
return formatted.replace(/\.0(?=[KMBT])/, '');
9292
} catch {
9393
return `${currency} ${value}`;
9494
}

0 commit comments

Comments
 (0)