From b3c6efaa735bb6a4634533bc24a14c6d0e004e26 Mon Sep 17 00:00:00 2001 From: Simao Rodrigues Date: Wed, 17 Jan 2024 12:10:19 +0000 Subject: [PATCH] Remove maximumSignificantDigits cap by default on the formatKM util; it can be set as options if needed --- .../containers/map/content/map/popup/protected-area/index.tsx | 3 +++ frontend/src/lib/utils/formats.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/containers/map/content/map/popup/protected-area/index.tsx b/frontend/src/containers/map/content/map/popup/protected-area/index.tsx index ecda80d3..e75fb8b4 100644 --- a/frontend/src/containers/map/content/map/popup/protected-area/index.tsx +++ b/frontend/src/containers/map/content/map/popup/protected-area/index.tsx @@ -133,6 +133,9 @@ const ProtectedAreaPopup = ({ locationId }: { locationId: number }) => { {format({ value: DATA?.REP_M_AREA, id: 'formatKM', + options: { + maximumSignificantDigits: 3, + }, })} Km2 diff --git a/frontend/src/lib/utils/formats.ts b/frontend/src/lib/utils/formats.ts index 50ae64b3..3ad4f41c 100644 --- a/frontend/src/lib/utils/formats.ts +++ b/frontend/src/lib/utils/formats.ts @@ -14,7 +14,7 @@ export function formatKM(value: number, options?: Intl.NumberFormatOptions) { compactDisplay: 'short', unit: 'kilometer', unitDisplay: 'short', - maximumSignificantDigits: 3, + maximumFractionDigits: 0, ...options, });