Skip to content

Commit d925633

Browse files
Mehdi ChamoumaMehdi Chamouma
authored andcommitted
Fix months and years calculation
1 parent 47a2daf commit d925633

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

app/js/timer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ angular.module('timer', [])
147147
$scope.minutes = Math.floor((($scope.millis / (60000)) % 60));
148148
$scope.hours = Math.floor((($scope.millis / (3600000)) % 24));
149149
$scope.days = Math.floor((($scope.millis / (3600000)) / 24) % 30);
150-
$scope.months = Math.floor(($scope.millis / (3600000)) / 24 / 30);
151-
$scope.years = Math.floor(($scope.millis / (3600000)) / 24 / 30 / 12);
150+
$scope.months = Math.floor((($scope.millis / (3600000)) / 24 / 30) % 12);
151+
$scope.years = Math.floor(($scope.millis / (3600000)) / 24 / 365);
152152
}
153153

154154
// plural - singular unit decision

dist/angular-timer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular-timer - v1.1.1 - 2014-05-17 3:24 AM
2+
* angular-timer - v1.1.1 - 2014-05-17 3:54 AM
33
* https://github.com/siddii/angular-timer
44
*
55
* Copyright (c) 2014 Siddique Hameed
@@ -154,8 +154,8 @@ angular.module('timer', [])
154154
$scope.minutes = Math.floor((($scope.millis / (60000)) % 60));
155155
$scope.hours = Math.floor((($scope.millis / (3600000)) % 24));
156156
$scope.days = Math.floor((($scope.millis / (3600000)) / 24) % 30);
157-
$scope.months = Math.floor(($scope.millis / (3600000)) / 24 / 30);
158-
$scope.years = Math.floor(($scope.millis / (3600000)) / 24 / 30 / 12);
157+
$scope.months = Math.floor((($scope.millis / (3600000)) / 24 / 30) % 12);
158+
$scope.years = Math.floor(($scope.millis / (3600000)) / 24 / 365);
159159
}
160160

161161
// plural - singular unit decision

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.

0 commit comments

Comments
 (0)