diff --git a/frontend/home/index.html b/frontend/home/index.html
index fb428da..59774b7 100644
--- a/frontend/home/index.html
+++ b/frontend/home/index.html
@@ -5,8 +5,8 @@
Temperature-Alarm-Web
-
-
+
+
diff --git a/frontend/scripts/home.js b/frontend/scripts/home.js
index e852e06..e615b9c 100644
--- a/frontend/scripts/home.js
+++ b/frontend/scripts/home.js
@@ -29,8 +29,9 @@ function buildTable(data, offset = 0) {
color = "tempNormal";
}
- const date = new Date(log.date).toLocaleDateString();
- const time = new Date(log.date).toLocaleTimeString();
+ const parsedDate = luxon.DateTime.fromISO(log.date).setZone("Europe/Copenhagen").setLocale("gb");
+ const date = parsedDate.toLocaleString(luxon.DateTime.DATE_SHORT);
+ const time = parsedDate.toLocaleString(luxon.DateTime.TIME_WITH_SECONDS);
document.getElementById("table-body").innerHTML += `
@@ -81,11 +82,17 @@ function isSameDay(a, b) {
a.getDate() === b.getDate();
}
+function localToUTC(date) {
+ if (!date) return null;
+
+ return luxon.DateTime.fromISO(date, { zone: "Europe/Copenhagen" }).setZone("UTC");
+}
+
async function fetchData() {
document.body.classList.add("loading");
- const startDate = document.getElementById("period-start").value;
- const endDate = document.getElementById("period-end").value;
+ const startDate = localToUTC(document.getElementById("period-start").value);
+ const endDate = localToUTC(document.getElementById("period-end").value);
const deviceData = [];
@@ -132,6 +139,11 @@ async function fetchData() {
hour: "HH:mm",
},
},
+ adapters: {
+ date: {
+ zone: "Europe/Copenhagen",
+ },
+ },
},
},
},
diff --git a/frontend/styles/home.css b/frontend/styles/home.css
index 90a045e..85eea8a 100644
--- a/frontend/styles/home.css
+++ b/frontend/styles/home.css
@@ -76,6 +76,9 @@ table .temperature {
table tr:not(:last-child) .temperature {
border-bottom-color: white;
}
+td {
+ white-space: nowrap;
+}
.tempHigh {
background-color: #ff0000;