Updated timestamps to local time

only_http
John Hays 9 months ago
parent 1447860088
commit 440e3eb922

@ -28,16 +28,18 @@ socket.addEventListener("title", data => {
socket.addEventListener("links", data => {
// console.log("links " + data);
$("#links").empty();
$("#links").append("<table id=\"linktable\"><caption>Links</caption>");
$("#linktable").append("<tr><th>Repeater</th><th>Reflector</th><th>Protocol</th>" +
"<th>Device</th><th>Direction</th><th>Timestamp</th></tr>");
$.each(data, function(index,val){
const utcDate = new Date(val.timestamp);
var reflector = val.reflector.substring(0,7).trim();
if (reflector.substring(0,3) == "REF") reflector = "<a href=\"http://" + reflector + ".dstargateway.org\" target=\"reflector\">" + val.reflector + "</a>";
$("#linktable").append("<tr><td>" + val.repeater + "</td><td>" + reflector +
"</td><td>" + val.protocol + "</td><td>" + val.device + "</td><td>" +
val.direction + "</td><td>" + val.timestamp + "</td></tr>");
val.direction + "</td><td>" + utcDate.toLocaleString() + "</td></tr>");
// console.log(index, val);
});
});
@ -60,9 +62,12 @@ socket.addEventListener("lastheard", data => {
// console.log("lastheard " + data);
$("#lastheard").empty();
$("#lastheard").append("<table id=\"lhtable\"><caption>Last Heard</caption>");
$("#lhtable").append("<tr><th>MYcall</th><th>URcall</th><th>Rpt1</th><th>Rpt2</th><th>Source</th><th>Date</th><th>Time</th></tr>");
$("#lhtable").append("<tr><th>MYcall</th><th>URcall</th><th>Rpt1</th><th>Rpt2</th><th>Source</th><th>Date</th><th>Time</th><th>Local</th></tr>");
$.each(data, function(index,val){
// console.log(index, val);
const utcDate = val.date.trim() + 'T' + val.time.trim() + 'Z';
const udate = new Date(utcDate);
const ldate = udate.toLocaleString();
var mcall = "<a href=\"https://qrz.com/db/" + val.mycall + "\" target=\"qrz\">" + val.mycall + "</a>";
if (val.msg1 != "") mcall += " / " + val.msg1;
var rpt1 = val.rpt1.substring(0,7).trim();
@ -79,6 +84,7 @@ socket.addEventListener("lastheard", data => {
}
$("#lhtable").append("<tr><td>" + mcall + "</td><td>"+ val.urcall +
"</td><td>" + rpt1 + "</td><td>" + rpt2 +
"</td><td>" + val.source + "</td><td>" + val.date + "</td><td>" + val.time + "</td></tr>");
"</td><td>" + val.source + "</td><td>" + val.date + "</td><td>" + val.time + "</td>" +
"<td>" + ldate +"</td></tr>");
})
});

@ -86,7 +86,7 @@ function updatelinks() {
if(lines[i] != "") {
var mylinks = lines[i].match(linksregex);
// console.log(JSON.stringify(lines[i]));
var linkrec = {'timestamp':mylinks[1].substr(0,19) , 'protocol':mylinks[2] , 'device':mylinks[4],
var linkrec = {'timestamp':mylinks[1].substr(0,19)+'Z' , 'protocol':mylinks[2] , 'device':mylinks[4],
'repeater':mylinks[5] , 'reflector':mylinks[6] , 'direction' : mylinks[7] };
linklist.push(linkrec);
}

Loading…
Cancel
Save