Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added timezone to directive #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ bower_components
log
node_modules
.project
*.iml
*.ipr
*.iws
7 changes: 4 additions & 3 deletions dist/angular-timeago-core.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.
* @version v0.4.3 - 2016-09-05
* @version v0.4.3 - 2016-10-19
* @link https://github.com/yaru22/angular-timeago
* @author Brian Park <yaru22@gmail.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -53,7 +53,8 @@ angular.module('yaru22.angular-timeago').directive('timeAgo', ["timeAgo", "nowTi
return {
scope: {
fromTime: '@',
format: '@'
format: '@',
timezone: '@'
},
restrict: 'EA',
link: function(scope, elem) {
Expand All @@ -68,7 +69,7 @@ angular.module('yaru22.angular-timeago').directive('timeAgo', ["timeAgo", "nowTi
scope.$watch(function() {
return nowTime() - fromTime;
}, function(value) {
angular.element(elem).text(timeAgo.inWords(value, fromTime, scope.format));
angular.element(elem).text(timeAgo.inWords(value, fromTime, scope.format, scope.timezone));
});
}
};
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-timeago-core.min.js

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

7 changes: 4 additions & 3 deletions dist/angular-timeago.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.
* @version v0.4.3 - 2016-09-05
* @version v0.4.3 - 2016-10-19
* @link https://github.com/yaru22/angular-timeago
* @author Brian Park <yaru22@gmail.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -411,7 +411,8 @@ angular.module('yaru22.angular-timeago').directive('timeAgo', ["timeAgo", "nowTi
return {
scope: {
fromTime: '@',
format: '@'
format: '@',
timezone: '@'
},
restrict: 'EA',
link: function(scope, elem) {
Expand All @@ -426,7 +427,7 @@ angular.module('yaru22.angular-timeago').directive('timeAgo', ["timeAgo", "nowTi
scope.$watch(function() {
return nowTime() - fromTime;
}, function(value) {
angular.element(elem).text(timeAgo.inWords(value, fromTime, scope.format));
angular.element(elem).text(timeAgo.inWords(value, fromTime, scope.format, scope.timezone));
});
}
};
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-timeago.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"chai": "3.5.0",
"grunt": "0.4.5",
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-connect": "1.0.2",
Expand Down
5 changes: 3 additions & 2 deletions src/time-ago.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ angular.module('yaru22.angular-timeago').directive('timeAgo', function(timeAgo,
return {
scope: {
fromTime: '@',
format: '@'
format: '@',
timezone: '@'
},
restrict: 'EA',
link: function(scope, elem) {
Expand All @@ -19,7 +20,7 @@ angular.module('yaru22.angular-timeago').directive('timeAgo', function(timeAgo,
scope.$watch(function() {
return nowTime() - fromTime;
}, function(value) {
angular.element(elem).text(timeAgo.inWords(value, fromTime, scope.format));
angular.element(elem).text(timeAgo.inWords(value, fromTime, scope.format, scope.timezone));
});
}
};
Expand Down