fixed timezone handling

This commit is contained in:
Oscar Krause
2023-01-03 21:49:24 +01:00
parent 76a69eef31
commit 4047636fa8
2 changed files with 16 additions and 3 deletions

View File

@@ -49,6 +49,17 @@ async function fetchOriginsWithLeases(element) {
}
async function fetchLeases(element) {
// datetime config
const dtc = {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
timeZoneName: "short"
}
let xhr = new XMLHttpRequest();
xhr.open("GET", '/-/leases?origin=true', true);
xhr.onreadystatechange = function () {
@@ -74,9 +85,9 @@ async function fetchLeases(element) {
let row = document.createElement('tr');
row.innerHTML = `
<td><code>${o.lease_ref}</code></td>
<td>${o.lease_created}</td>
<td>${o.lease_updated}</td>
<td>${o.lease_expires}</td>
<td>${new Date(o.lease_created).toLocaleDateString('system', dtc)}</td>
<td>${new Date(o.lease_updated).toLocaleDateString('system', dtc)}</td>
<td>${new Date(o.lease_expires).toLocaleDateString('system', dtc)}</td>
<td><code>${o.origin_ref}</code></td>`
tbody.appendChild(row);
})