dashboard: use server time to calculate event time

This commit is contained in:
nemunaire 2019-01-23 01:40:14 +01:00
parent 17a9d39556
commit 42a17ab450
1 changed files with 5 additions and 1 deletions

View File

@ -3,7 +3,11 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.events = [];
var refreshEvents = function() {
// Update times
var now = new Date().getTime();
var time = angular.fromJson(sessionStorage.time);
var now = Date.now();
if (time)
now += time.cu - time.he;
now = new Date(now);
$scope.events.forEach(function(ev) {
ev.since = now - ev.time;
});