Skip to content

Commit

Permalink
seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
ipitio committed Feb 8, 2024
1 parent f289cab commit 83664ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api_speedtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/pi-hole/js/speedresults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions scripts/pi-hole/js/speedtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 83664ba

Please sign in to comment.