dashboard: use server time to calculate event time
This commit is contained in:
parent
17a9d39556
commit
42a17ab450
1 changed files with 5 additions and 1 deletions
|
@ -3,7 +3,11 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
|
||||||
$scope.events = [];
|
$scope.events = [];
|
||||||
var refreshEvents = function() {
|
var refreshEvents = function() {
|
||||||
// Update times
|
// 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) {
|
$scope.events.forEach(function(ev) {
|
||||||
ev.since = now - ev.time;
|
ev.since = now - ev.time;
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue