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

@ -15,6 +15,8 @@ from fastapi import FastAPI
from fastapi.requests import Request
from jose import jws, jwk, jwt, JWTError
from jose.constants import ALGORITHMS
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import StreamingResponse, JSONResponse, Response, RedirectResponse
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from starlette.middleware.cors import CORSMiddleware

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);
})