Skip to content

Commit 41caa67

Browse files
committed
fix plurial, now 0 and 1 return '', instead of 's' for 0
1 parent e54608f commit 41caa67

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/js/timer.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ var timerModule = angular.module('timer', [])
154154
$scope.years = Math.floor(($scope.millis / (3600000)) / 24 / 365);
155155
}
156156
// plural - singular unit decision
157-
$scope.secondsS = $scope.seconds == 1 ? '' : 's';
158-
$scope.minutesS = $scope.minutes == 1 ? '' : 's';
159-
$scope.hoursS = $scope.hours == 1 ? '' : 's';
160-
$scope.daysS = $scope.days == 1 ? '' : 's';
161-
$scope.monthsS = $scope.months == 1 ? '' : 's';
162-
$scope.yearsS = $scope.years == 1 ? '' : 's';
157+
$scope.secondsS = ($scope.seconds == 1 || $scope.seconds == 0) ? '' : 's';
158+
$scope.minutesS = ($scope.minutes == 1 || $scope.minutes == 0) ? '' : 's';
159+
$scope.hoursS = ($scope.hours == 1 || $scope.hours == 0) ? '' : 's';
160+
$scope.daysS = ($scope.days == 1 || $scope.days == 0)? '' : 's';
161+
$scope.monthsS = ($scope.months == 1 || $scope.months == 0)? '' : 's';
162+
$scope.yearsS = ($scope.years == 1 || $scope.years == 0)? '' : 's';
163163
//add leading zero if number is smaller than 10
164164
$scope.sseconds = $scope.seconds < 10 ? '0' + $scope.seconds : $scope.seconds;
165165
$scope.mminutes = $scope.minutes < 10 ? '0' + $scope.minutes : $scope.minutes;

0 commit comments

Comments
 (0)