Timer displaying 0-1:0-1:0-1
We faced timer issue. in the local system, the format it is displaying 00:00:00. But when we are deployed the same code in to public server, then the timer, it is displaying as 01-0-2-01 format. How can we change the format to 00:00:00 for front end.
Help me you have any solution...
Got the same problem. Only after minification
+1
+1
I have solved the problem by changing 3 methods:
$scope.start = $element[0].start = function () {
var now = moment();
var startTime = $scope.startTimeAttr ? moment($scope.startTimeAttr) : null;
if (!startTime || startTime > now) {
$scope.startTime = now;
} else {
$scope.startTime = startTime;
}
var endTime = $scope.endTimeAttr ? moment($scope.endTimeAttr) : null;
if (!endTime || endTime < now) {
$scope.endTime = null;
} else {
$scope.endTime = endTime;
}
if (!angular.isNumber($scope.countdown)) {
$scope.countdown = angular.isNumber($scope.countdownattr) && parseInt($scope.countdownattr, 10) > 0 ? parseInt($scope.countdownattr, 10) : undefined;
}
resetTimeout();
tick();
$scope.isRunning = true;
};
$scope.reset = $element[0].reset = function () {
var now = moment();
var startTime = $scope.startTimeAttr ? moment($scope.startTimeAttr) : null;
if (!startTime || startTime > now) {
$scope.startTime = now;
} else {
$scope.startTime = startTime;
}
var endTime = $scope.endTimeAttr ? moment($scope.endTimeAttr) : null;
if (!endTime || endTime < now) {
$scope.endTime = null;
} else {
$scope.endTime = endTime;
}
$scope.countdown = angular.isNumber($scope.countdownattr) && parseInt($scope.countdownattr, 10) > 0 ? parseInt($scope.countdownattr, 10) : undefined;
resetTimeout();
tick();
$scope.isRunning = false;
$scope.clear();
};
function calculateTimeUnits() {
var timeUnits = {}; //will contains time with units
if ($attrs.startTime !== undefined){
$scope.millis = moment().diff(moment($scope.startTime));
}
....
};
If anyone finds this later, I was using pug (formerly jade) to render HTML. Putting a variable in quotes wasn't rendering the variable for it's value, but sending in the string. Normally putting the variable name in strings is how they get rendered, but here it was just passing the string startTime in, causing it to show as
0-1 : 0-1 : 0-1
startTime wasn't undefined, and $scope.millis after the if statement from calculateTimeUnits (as shown above) was returning a value of -1.
timer(start-time='startTime' autostart='false' interval='1000') {{hhours}} : {{mminutes}} : {{sseconds}}
Fixed:
timer(start-time=startTime autostart='false' interval='1000') {{hhours}} : {{mminutes}} : {{sseconds}}
I have the same problem:

Html code is:
<timer start-time="tableWait[kq].data[tableWait[kq].data.length-1].waitingTime" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>
Any news on that ?
+1