change timestamp
This commit is contained in:
@ -80,21 +80,27 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
const utcString = "Wed, 16 Jul 2025 20:17:45 GMT";
|
function formatToMakassar(utcStr) {
|
||||||
const date = new Date(utcString);
|
const options = {
|
||||||
|
timeZone: 'Asia/Makassar',
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'short',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit',
|
||||||
|
weekday: 'short',
|
||||||
|
hour12: false,
|
||||||
|
};
|
||||||
|
|
||||||
// Format to Asia/Makassar timezone
|
const date = new Date(utcStr);
|
||||||
const formatter = new Intl.DateTimeFormat('en-US', {
|
const formatter = new Intl.DateTimeFormat('en-US', options);
|
||||||
timeZone: 'Asia/Makassar',
|
const parts = formatter.formatToParts(date);
|
||||||
year: 'numeric',
|
|
||||||
month: 'short',
|
const get = (type) => parts.find(p => p.type === type)?.value;
|
||||||
day: '2-digit',
|
|
||||||
hour: '2-digit',
|
return `${get('weekday')}, ${get('day')} ${get('month')} ${get('year')} ${get('hour')}:${get('minute')}:${get('second')} GMT+8`;
|
||||||
minute: '2-digit',
|
}
|
||||||
second: '2-digit',
|
|
||||||
weekday: 'short',
|
|
||||||
hour12: false,
|
|
||||||
});
|
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/get_video');
|
const response = await fetch('/get_video');
|
||||||
@ -114,7 +120,7 @@
|
|||||||
<td>${entry.id}</td>
|
<td>${entry.id}</td>
|
||||||
<td>${entry.vehicle_id}</td>
|
<td>${entry.vehicle_id}</td>
|
||||||
<td>${entry.direction}</td>
|
<td>${entry.direction}</td>
|
||||||
<td>${formatter.format(entry.timestamp)}</td>
|
<td>${formatToMakassar(entry.timestamp)}</td>
|
||||||
<td>${entry.speed.toFixed(1)}</td>
|
<td>${entry.speed.toFixed(1)}</td>
|
||||||
`;
|
`;
|
||||||
tbody.appendChild(row);
|
tbody.appendChild(row);
|
||||||
|
|||||||
Reference in New Issue
Block a user