change timestamp

This commit is contained in:
kicap
2025-07-16 20:19:27 +08:00
parent 40a4cbaafc
commit c2691fa35e

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Traffic Monitor</title>
@ -29,7 +30,8 @@
background-color: white;
}
th, td {
th,
td {
border: 1px solid #ccc;
padding: 8px 12px;
text-align: center;
@ -48,12 +50,14 @@
}
</style>
</head>
<body>
<h1>Monitoring Trafik</h1>
<div id="stats">
<div class="stat">🔢 Total Entri Log Kendaraan: <span id="total-entries" class="loading">Loading...</span></div>
<div class="stat">🚗 Kendaraan yang Saat Ini Berada di Antara Jalur: <span id="vehicle-zone" class="loading">Loading...</span></div>
<div class="stat">🚗 Kendaraan yang Saat Ini Berada di Antara Jalur: <span id="vehicle-zone"
class="loading">Loading...</span></div>
</div>
<h2>📋 10 Entri Kendaraan Terakhir</h2>
@ -68,11 +72,29 @@
</tr>
</thead>
<tbody id="log-table-body">
<tr><td colspan="5" class="loading">Loading data...</td></tr>
<tr>
<td colspan="5" class="loading">Loading data...</td>
</tr>
</tbody>
</table>
<script>
const utcString = "Wed, 16 Jul 2025 20:17:45 GMT";
const date = new Date(utcString);
// Format to Asia/Makassar timezone
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: 'Asia/Makassar',
year: 'numeric',
month: 'short',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
weekday: 'short',
hour12: false,
});
async function loadData() {
try {
const response = await fetch('/get_video');
@ -92,7 +114,7 @@
<td>${entry.id}</td>
<td>${entry.vehicle_id}</td>
<td>${entry.direction}</td>
<td>${entry.timestamp}</td>
<td>${formatter.format(entry.timestamp)}</td>
<td>${entry.speed.toFixed(1)}</td>
`;
tbody.appendChild(row);
@ -111,4 +133,5 @@
setInterval(loadData, 5000);
</script>
</body>
</html>
</html>