From 8acc2e4e80d4cdbd727f2710ab754458295ee711 Mon Sep 17 00:00:00 2001 From: valia fetisov Date: Tue, 6 Dec 2022 19:06:33 +0100 Subject: [PATCH] fix: Disable number formatting after decimal point (#559) --- core/src/helpers/formatToAutomaticDecimalPoints.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/helpers/formatToAutomaticDecimalPoints.ts b/core/src/helpers/formatToAutomaticDecimalPoints.ts index 23a5e4046..3407cf243 100644 --- a/core/src/helpers/formatToAutomaticDecimalPoints.ts +++ b/core/src/helpers/formatToAutomaticDecimalPoints.ts @@ -60,7 +60,9 @@ function limitedValue(value: number | BigNumber): number | BigNumber { export function formatWithThousandSeparators(value: string): string { // We choose regex over native JS solutions, as using native solutions only support numbers - return value.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,'); + const parts = value.toString().split('.'); + parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); + return parts.join('.'); } interface formatToAutomaticDecimalPointsOptions {