Skip to content

Commit 438b38f

Browse files
committed
added simple variable for S for plural/singular units
1 parent a4fbd4d commit 438b38f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/js/timer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,13 @@ angular.module('timer', [])
9696

9797
function calculateTimeUnits() {
9898
$scope.seconds = Math.floor(($scope.millis / 1000) % 60);
99+
$scope.secondsS = $scope.seconds==1 ? '' : 's';
99100
$scope.minutes = Math.floor((($scope.millis / (60000)) % 60));
101+
$scope.minutesS = $scope.minutesS==1 ? '' : 's';
100102
$scope.hours = Math.floor((($scope.millis / (3600000)) % 24));
103+
$scope.hoursS = $scope.hoursS==1 ? '' : 's';
101104
$scope.days = Math.floor((($scope.millis / (3600000)) / 24));
105+
$scope.daysS = $scope.daysS==1 ? '' : 's';
102106
}
103107

104108
//determine initial values of time units and add AddSeconds functionality

0 commit comments

Comments
 (0)