Skip to content

Commit

Permalink
Don't override fraction digits on SummaryCard
Browse files Browse the repository at this point in the history
This allows formatForDisplay to determine digits appropriately (e.g. instead of 300.1, just shows 300)
  • Loading branch information
JGreenlee committed Sep 25, 2024
1 parent d89cf5a commit bc01697
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions www/js/metrics/SumaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ const SummaryCard = ({ title, unit, value, nDays, goals }: Props) => {
const perDayValue = value.map((v) => v / nDays) as Value;

const formatVal = (v: Value) => {
const opts = { maximumFractionDigits: 1 };
if (valueIsRange) return `${formatForDisplay(v[0], opts)} - ${formatForDisplay(v[1], opts)}`;
return `${formatForDisplay(v[0], opts)}`;
if (valueIsRange) return `${formatForDisplay(v[0])} - ${formatForDisplay(v[1])}`;
return `${formatForDisplay(v[0])}`;
};

const colorFn = (v: Value) => {
Expand Down

0 comments on commit bc01697

Please sign in to comment.