From a29556ee8ec50aa384a9a46f6f5a5fa5dfa4cdac Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 12 Apr 2025 17:53:40 +0200 Subject: [PATCH] fix(widget): format stock values and changes for better readability (#2836) --- packages/widgets/src/stocks/component.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/widgets/src/stocks/component.tsx b/packages/widgets/src/stocks/component.tsx index 326301d54..c5dfe15d6 100644 --- a/packages/widgets/src/stocks/component.tsx +++ b/packages/widgets/src/stocks/component.tsx @@ -67,12 +67,13 @@ export default function StockPriceWidget({ options, width, height }: WidgetCompo 280 ? 1 : 2} fw={700}> - {round(stockValues[stockValues.length - 1] ?? 0)} + {new Intl.NumberFormat().format(round(stockValues[stockValues.length - 1] ?? 0))} {width > 280 && ( - {Math.abs(stockValuesChange)} ({Math.abs(stockValuesChangePercentage)}%) + {new Intl.NumberFormat().format(stockValuesChange)} ({stockValuesChange > 0 ? "+" : ""} + {new Intl.NumberFormat().format(stockValuesChangePercentage)}%) )}