Skip to content

Commit 67ec112

Browse files
committed
v1.1.8
1 parent 7016978 commit 67ec112

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module.exports = function (grunt) {
6767
sub: true,
6868
boss: true,
6969
eqnull: true
70-
},
70+
}
7171
},
7272

7373
connect: {

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Siddique Hameed",
33
"name": "angular-timer",
4-
"version": "1.1.6",
4+
"version": "1.1.8",
55
"homepage": "https://github.com/siddii/angular-timer",
66
"description": "Angular-Timer : A simple AngularJS directive demonstrating re-usability & interoperability",
77
"repository": {

dist/angular-timer.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular-timer - v1.1.6 - 2014-07-01 7:37 AM
2+
* angular-timer - v1.1.8 - 2014-10-24 3:55 PM
33
* https://github.com/siddii/angular-timer
44
*
55
* Copyright (c) 2014 Siddique Hameed
@@ -113,7 +113,9 @@ var timerModule = angular.module('timer', [])
113113
});
114114

115115
function calculateTimeUnits() {
116-
116+
if ($attrs.startTime !== undefined){
117+
$scope.millis = new Date() - new Date($scope.startTimeAttr);
118+
}
117119
// compute time values based on maxTimeUnit specification
118120
if (!$scope.maxTimeUnit || $scope.maxTimeUnit === 'day') {
119121
$scope.seconds = Math.floor(($scope.millis / 1000) % 60);
@@ -158,14 +160,13 @@ var timerModule = angular.module('timer', [])
158160
$scope.months = Math.floor((($scope.millis / (3600000)) / 24 / 30) % 12);
159161
$scope.years = Math.floor(($scope.millis / (3600000)) / 24 / 365);
160162
}
161-
162163
// plural - singular unit decision
163-
$scope.secondsS = $scope.seconds == 1 ? '' : 's';
164-
$scope.minutesS = $scope.minutes == 1 ? '' : 's';
165-
$scope.hoursS = $scope.hours == 1 ? '' : 's';
166-
$scope.daysS = $scope.days == 1 ? '' : 's';
167-
$scope.monthsS = $scope.months == 1 ? '' : 's';
168-
$scope.yearsS = $scope.years == 1 ? '' : 's';
164+
$scope.secondsS = ($scope.seconds === 1 || $scope.seconds === 0) ? '' : 's';
165+
$scope.minutesS = ($scope.minutes === 1 || $scope.minutes === 0) ? '' : 's';
166+
$scope.hoursS = ($scope.hours === 1 || $scope.hours === 0) ? '' : 's';
167+
$scope.daysS = ($scope.days === 1 || $scope.days === 0)? '' : 's';
168+
$scope.monthsS = ($scope.months === 1 || $scope.months === 0)? '' : 's';
169+
$scope.yearsS = ($scope.years === 1 || $scope.years === 0)? '' : 's';
169170
//add leading zero if number is smaller than 10
170171
$scope.sseconds = $scope.seconds < 10 ? '0' + $scope.seconds : $scope.seconds;
171172
$scope.mminutes = $scope.minutes < 10 ? '0' + $scope.minutes : $scope.minutes;

dist/angular-timer.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Siddique Hameed",
33
"name": "angular-timer",
4-
"version": "1.1.6",
4+
"version": "1.1.8",
55
"homepage": "https://github.com/siddii/angular-timer",
66
"main":"dist/angular-timer.js",
77
"licenses": {

0 commit comments

Comments
 (0)