Skip to content

Commit 77562bb

Browse files
committed
Fixed the PingChart.jsx displaying the server time
1 parent 8348f53 commit 77562bb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

client/src/pages/Statistics/charts/PingChart.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ const chartOptions = {
1818
};
1919

2020
const SpeedChart = (props) => {
21+
const testTime = localStorage.getItem("testTime") || 1;
2122
const chartData = {
22-
labels: props.labels,
23+
labels: testTime < 3 ? props.labels.map((label) => new Date(label).toLocaleTimeString([],
24+
{hour: "2-digit", minute: "2-digit"})) : props.labels.slice(1).map((label) =>
25+
new Date(label).toLocaleDateString()),
2326
datasets: [
2427
{
2528
label: t("latest.ping"),
26-
data: props.data.ping,
29+
data: testTime < 3 ? props.data.ping : props.data.ping.slice(1),
2730
borderColor: '#45C65A',
2831
},
2932
],

0 commit comments

Comments
 (0)