From e88c607ed19ad0dbb15268ce8649696cd0cb29fd Mon Sep 17 00:00:00 2001 From: techillin <48240363+techillin@users.noreply.github.com> Date: Wed, 17 Nov 2021 11:23:57 +0100 Subject: [PATCH] Update index.js Locale-aware number formatting --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 5cf133f..d3bf490 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -import { handleClick, secondsToDuration } from 'custom-card-helpers'; +import { handleClick, secondsToDuration, formatNumber } from 'custom-card-helpers'; import { checkEntity, entityName, entityStateDisplay, entityStyles, entityUnit, entityValue } from './entity'; import { getEntityIds, hasConfigOrEntitiesChanged, hasGenericSecondaryInfo, isObject, hideUnavailable } from './util'; import { style } from './styles'; @@ -153,7 +153,7 @@ class MultipleEntityRow extends LitElement { if (config.format.startsWith('precision')) { const unit = entityUnit(stateObj, config); const precision = parseInt(config.format.slice(-1), 10); - return `${parseFloat(value).toFixed(precision)}${unit ? ` ${unit}` : ''}`; + return `${formatNumber(parseFloat(value).toFixed(precision))}${unit ? ` ${unit}` : ''}`; } return value; }