Use server time for computing seconds
This commit is contained in:
@@ -212,6 +212,7 @@ function main() {
|
||||
|
||||
/* Improve attacks display */
|
||||
if (section === "ally" && module === "attacks") {
|
||||
let serverTime = parseInt(document.getElementById("servertime").getAttribute("time"));
|
||||
let contentPane = document.getElementsByClassName("contentpane")[1]
|
||||
let table = contentPane.getElementsByClassName("borderlist")[0];
|
||||
let rows = table.getElementsByTagName("tr");
|
||||
@@ -225,7 +226,7 @@ function main() {
|
||||
let arrivalTimeCell = cells[4];
|
||||
|
||||
let seconds = parseInt(arrivalTimeCell.getElementsByTagName("span")[0].getAttribute("time"));
|
||||
let arrival = new Date(Date.now() + seconds * 1000);
|
||||
let arrival = new Date((serverTime + seconds) * 1000);
|
||||
let hour = arrival.toLocaleTimeString("fr-FR");
|
||||
arrivalDateCell.textContent = arrivalDateCell.textContent.replace(/(.*)\d\d:\d\d(.*)/, "$1" + hour + "$2");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user