aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/Shared/Graph.jsx13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/web/src/components/Shared/Graph.jsx b/src/web/src/components/Shared/Graph.jsx
index d383345f..386f9a46 100644
--- a/src/web/src/components/Shared/Graph.jsx
+++ b/src/web/src/components/Shared/Graph.jsx
@@ -112,11 +112,14 @@ const Graph = ({ data = [], defaultSeries, height = 200, series = [] }) => {
});
}
- return (timestamp) =>
- new Date(timestamp).toLocaleDateString(undefined, {
- day: 'numeric',
- month: 'short',
- });
+ const spansYears =
+ new Date(xRange.min).getFullYear() !== new Date(xRange.max).getFullYear();
+
+ return (timestamp) => {
+ const d = new Date(timestamp);
+ const date = d.toLocaleDateString(undefined, { day: 'numeric', month: 'short' });
+ return spansYears ? `${date} '${String(d.getFullYear()).slice(2)}` : date;
+ };
}, [xRange]);
const yFormatter = useMemo(() => {