From 83664badb956bf4d65751ff3f34a2fdce5fbca25 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:43:34 -0500 Subject: [PATCH] seconds --- api_speedtest.php | 4 ++-- scripts/pi-hole/js/speedresults.js | 4 ++-- scripts/pi-hole/js/speedtest.js | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api_speedtest.php b/api_speedtest.php index 55ed7d2a5..fd1dade55 100644 --- a/api_speedtest.php +++ b/api_speedtest.php @@ -138,8 +138,8 @@ function getSpeedTestData($dbSpeedtest, $durationdays = '1') $curdate = new DateTime('now', new DateTimeZone('UTC')); $daysago = new DateTime('now', new DateTimeZone('UTC')); $daysago->modify('-'.$durationdays.' day'); - $curdate = $curdate->format('Y-m-d\TH:i'); - $daysago = $daysago->format('Y-m-d\TH:i'); + $curdate = $curdate->format('Y-m-d\TH:i:s'); + $daysago = $daysago->format('Y-m-d\TH:i:s'); $sql = "SELECT * from speedtest where start_time between '{$daysago}' and '{$curdate}' order by id asc"; } diff --git a/scripts/pi-hole/js/speedresults.js b/scripts/pi-hole/js/speedresults.js index 0a32371c8..724982f73 100644 --- a/scripts/pi-hole/js/speedresults.js +++ b/scripts/pi-hole/js/speedresults.js @@ -49,7 +49,7 @@ $(document).ready(function () { { render: function (data, type, _full, _meta) { if (type === "display") { - moment.utc(data, "YYYY-MM-DDTHH:mm").local().format(); + moment.utc(data).local().format(); } return data; @@ -58,7 +58,7 @@ $(document).ready(function () { { render: function (data, type, _full, _meta) { if (type === "display") { - moment.utc(data, "YYYY-MM-DDTHH:mm").local().format(); + moment.utc(data).local().format(); } return data; diff --git a/scripts/pi-hole/js/speedtest.js b/scripts/pi-hole/js/speedtest.js index 2dae06205..bfee47295 100644 --- a/scripts/pi-hole/js/speedtest.js +++ b/scripts/pi-hole/js/speedtest.js @@ -131,16 +131,16 @@ function createChart() { function formatDate(itemdate, results) { let output = "HH:mm"; if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { - return moment.utc(itemdate, "YYYY-MM-DDTHH:mm").local().format(output); + return moment.utc(itemdate).local().format(output); } - const first = moment(results[0].start_time, "YYYY-MM-DDTHH:mm"); - const last = moment(results[results.length - 1].start_time, "YYYY-MM-DDTHH:mm"); + const first = moment(results.at(0).start_time); + const last = moment(results.at(-1).start_time); if (last.diff(first, "hours") > 24) { output = "Do HH:mm"; } - return moment.utc(itemdate, "YYYY-MM-DDTHH:mm").local().format(output); + return moment.utc(itemdate).local().format(output); } function updateSpeedTestData() {