From 6ea6866f8a72baf82e95b742e678903764b157f5 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 16 Feb 2021 11:30:27 +0100 Subject: [PATCH] Fix point to comma --- src/components/HomeCards/TotalConsumption.spec.tsx | 4 ++-- src/components/HomeCards/TotalConsumption.tsx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/HomeCards/TotalConsumption.spec.tsx b/src/components/HomeCards/TotalConsumption.spec.tsx index 76b499c5c..5b92a4442 100644 --- a/src/components/HomeCards/TotalConsumption.spec.tsx +++ b/src/components/HomeCards/TotalConsumption.spec.tsx @@ -37,7 +37,7 @@ describe('TotalConsumption component', () => { .find('.euro-value') .first() .text() - ).toEqual('20.23') + ).toEqual('20,23') }) it('should call Converter method', () => { const mockLoadToEuro = jest.fn() @@ -59,6 +59,6 @@ describe('TotalConsumption component', () => { .find('.euro-value') .first() .text() - ).toEqual('130.84') + ).toEqual('130,84') }) }) diff --git a/src/components/HomeCards/TotalConsumption.tsx b/src/components/HomeCards/TotalConsumption.tsx index d1e024c8d..fd6c7b8e3 100644 --- a/src/components/HomeCards/TotalConsumption.tsx +++ b/src/components/HomeCards/TotalConsumption.tsx @@ -5,6 +5,7 @@ import './totalConsumption.scss' import { Dataload } from 'models' import { FluidType } from 'enum/fluid.enum' import ConverterService from 'services/converter.service' +import { formatNumberValues } from 'utils/utils' interface TotalConsumptionProps { actualData: Dataload[] fluidType: FluidType @@ -27,11 +28,10 @@ const TotalConsumption: React.FC<TotalConsumptionProps> = ({ totalValue <= 0 ? '-----' : fluidType === FluidType.MULTIFLUID - ? totalValue.toFixed(2).toString() - : converterService - .LoadToEuro(totalValue, fluidType) - .toFixed(2) - .toString() + ? formatNumberValues(totalValue).toString() + : formatNumberValues( + converterService.LoadToEuro(totalValue, fluidType) + ).toString() return displayedValue } setTotalValue(calculateTotalValue()) -- GitLab