diff --git a/ViewGraph.tsx b/ViewGraph.tsx index 9a9f7e4..bb81661 100644 --- a/ViewGraph.tsx +++ b/ViewGraph.tsx @@ -78,39 +78,31 @@ export default function ViewGraph() { const weightChart = useMemo(() => { if (weights === undefined) return null; - let periodFormat = "do"; - if (period === Periods.Weekly) periodFormat = "iii"; - else if (period === Periods.Yearly) periodFormat = "P"; - if (weights.length === 0) return ; return ( set.weight)} labels={weights.map((set) => - format(new Date(set.created), periodFormat) + format(new Date(set.created), "yyyy-MM-d") )} /> ); - }, [weights, period]); + }, [weights]); const volumeChart = useMemo(() => { if (volumes === undefined) return null; - - let periodFormat = "do"; - if (period === Periods.Weekly) periodFormat = "iii"; - else if (period === Periods.Yearly) periodFormat = "P"; - if (volumes.length === 0) return ; + return ( volume.value)} labels={volumes.map((volume) => - format(new Date(volume.created), periodFormat) + format(new Date(volume.created), "yyyy-MM-d") )} /> ); - }, [volumes, period]); + }, [volumes]); return ( <> diff --git a/ViewWeightGraph.tsx b/ViewWeightGraph.tsx index 50c04d3..497b060 100644 --- a/ViewWeightGraph.tsx +++ b/ViewWeightGraph.tsx @@ -47,19 +47,15 @@ export default function ViewWeightGraph() { return ; } - let periodFormat = "do"; - if (period === Periods.Weekly) periodFormat = "iii"; - else if (period === Periods.Yearly) periodFormat = "P"; - return ( set.value)} labels={weights.map((weight) => - format(new Date(weight.created), periodFormat) + format(new Date(weight.created), "yyyy-MM-d") )} /> ); - }, [weights, period]); + }, [weights]); return ( <>