Skip to content

Commit

Permalink
v1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
siddii committed Oct 24, 2014
1 parent 7016978 commit 67ec112
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = function (grunt) {
sub: true,
boss: true,
eqnull: true
},
}
},

connect: {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Siddique Hameed",
"name": "angular-timer",
"version": "1.1.6",
"version": "1.1.8",
"homepage": "https://github.com/siddii/angular-timer",
"description": "Angular-Timer : A simple AngularJS directive demonstrating re-usability & interoperability",
"repository": {
Expand Down
19 changes: 10 additions & 9 deletions dist/angular-timer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* angular-timer - v1.1.6 - 2014-07-01 7:37 AM
* angular-timer - v1.1.8 - 2014-10-24 3:55 PM
* https://github.com/siddii/angular-timer
*
* Copyright (c) 2014 Siddique Hameed
Expand Down Expand Up @@ -113,7 +113,9 @@ var timerModule = angular.module('timer', [])
});

function calculateTimeUnits() {

if ($attrs.startTime !== undefined){
$scope.millis = new Date() - new Date($scope.startTimeAttr);
}
// compute time values based on maxTimeUnit specification
if (!$scope.maxTimeUnit || $scope.maxTimeUnit === 'day') {
$scope.seconds = Math.floor(($scope.millis / 1000) % 60);
Expand Down Expand Up @@ -158,14 +160,13 @@ var timerModule = angular.module('timer', [])
$scope.months = Math.floor((($scope.millis / (3600000)) / 24 / 30) % 12);
$scope.years = Math.floor(($scope.millis / (3600000)) / 24 / 365);
}

// plural - singular unit decision
$scope.secondsS = $scope.seconds == 1 ? '' : 's';
$scope.minutesS = $scope.minutes == 1 ? '' : 's';
$scope.hoursS = $scope.hours == 1 ? '' : 's';
$scope.daysS = $scope.days == 1 ? '' : 's';
$scope.monthsS = $scope.months == 1 ? '' : 's';
$scope.yearsS = $scope.years == 1 ? '' : 's';
$scope.secondsS = ($scope.seconds === 1 || $scope.seconds === 0) ? '' : 's';
$scope.minutesS = ($scope.minutes === 1 || $scope.minutes === 0) ? '' : 's';
$scope.hoursS = ($scope.hours === 1 || $scope.hours === 0) ? '' : 's';
$scope.daysS = ($scope.days === 1 || $scope.days === 0)? '' : 's';
$scope.monthsS = ($scope.months === 1 || $scope.months === 0)? '' : 's';
$scope.yearsS = ($scope.years === 1 || $scope.years === 0)? '' : 's';
//add leading zero if number is smaller than 10
$scope.sseconds = $scope.seconds < 10 ? '0' + $scope.seconds : $scope.seconds;
$scope.mminutes = $scope.minutes < 10 ? '0' + $scope.minutes : $scope.minutes;
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-timer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Siddique Hameed",
"name": "angular-timer",
"version": "1.1.6",
"version": "1.1.8",
"homepage": "https://github.com/siddii/angular-timer",
"main":"dist/angular-timer.js",
"licenses": {
Expand Down

0 comments on commit 67ec112

Please sign in to comment.