apply timer in proposal details

This commit is contained in:
Javier 2016-04-01 09:58:28 -03:00
parent 5ddecd0e66
commit 6f464b8009
1 changed files with 7 additions and 2 deletions

View File

@ -355,11 +355,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
}, 1000);
function setExpirationTime() {
if (moment().isAfter(expirationTime * 1000)) {
var now = Math.floor(Date.now() / 1000);
if (now > expirationTime) {
$scope.paymentExpired = true;
if (self.countDown) $interval.cancel(self.countDown);
return;
}
$scope.expires = moment(expirationTime * 1000).fromNow();
var totalSecs = expirationTime - now;
var m = Math.floor(totalSecs / 60);
var s = totalSecs % 60;
$scope.expires = ('0' + m).slice(-2) + ":" + ('0' + s).slice(-2);
};
};