diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f2ea75..35b28da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.2.2 - 2013-09-29 + +- Add support for passing unix timestamp as a string to amDateFormat filter ([#14](https://github.com/urish/angular-moment/issues/14)) + ## 0.2.1 - 2013-09-13 - Fix an issue with tests failing on a different timezone @@ -8,5 +12,5 @@ ## 0.2.0 - 2013-08-22 - Add optional am-format attribute to am-time-ago ([#11](https://github.com/urish/angular-moment/issues/11)) -- Add new amFormatDate filter ([#12](https://github.com/urish/angular-moment/issues/12)) +- Add new amDateFormat filter ([#12](https://github.com/urish/angular-moment/issues/12)) - Add changelog file diff --git a/angular-moment.js b/angular-moment.js index 2194823..2de452a 100644 --- a/angular-moment.js +++ b/angular-moment.js @@ -1,4 +1,4 @@ -/* angular-moment.js / v0.2.1 / (c) 2013 Uri Shaked / MIT Licence */ +/* angular-moment.js / v0.2.2 / (c) 2013 Uri Shaked / MIT Licence */ angular.module('angularMoment', []) .directive('amTimeAgo', ['$window', '$timeout', function ($window, $timeout) { @@ -73,7 +73,7 @@ angular.module('angularMoment', []) if(!isNaN(parseFloat(value)) && isFinite(value)) { // Milliseconds since the epoch - value = new Date(parseInt(value, null)); + value = new Date(parseInt(value, 10)); } // else assume the given value is already a date diff --git a/angular-moment.min.js b/angular-moment.min.js index ad80667..39362c6 100644 --- a/angular-moment.min.js +++ b/angular-moment.min.js @@ -1 +1 @@ -angular.module("angularMoment",[]).directive("amTimeAgo",["$window","$timeout",function(d,b){return function(c,n,m){function g(){e&&(b.cancel(e),e=null)}function h(a){n.text(a.fromNow());var c=d.moment().diff(a,"minute"),f=3600;1>c?f=1:60>c?f=30:180>c&&(f=300);e=b(function(){h(a)},1E3*f,!1)}var e=null,k,l;c.$watch(m.amTimeAgo,function(a){"undefined"!==typeof a&&null!==a&&(angular.isNumber(a)&&(a=new Date(a)),k=a,g(),h(d.moment(k,l)))});m.$observe("amFormat",function(a){l=a;g();h(d.moment(k,l))}); c.$on("$destroy",function(){g()})}}]).filter("amDateFormat",["$window",function(d){return function(b,c){if("undefined"===typeof b||null===b)return"";!isNaN(parseFloat(b))&&isFinite(b)&&(b=new Date(parseInt(b,null)));return d.moment(b).format(c)}}]); \ No newline at end of file +angular.module("angularMoment",[]).directive("amTimeAgo",["$window","$timeout",function(a,b){"use strict";return function(c,d,e){function f(){k&&(b.cancel(k),k=null)}function g(c){d.text(c.fromNow());var e=a.moment().diff(c,"minute"),f=3600;1>e?f=1:60>e?f=30:180>e&&(f=300),k=b(function(){g(c)},1e3*f,!1)}function h(){f(),g(a.moment(i,j))}var i,j,k=null;c.$watch(e.amTimeAgo,function(a){"undefined"!=typeof a&&null!==a&&(angular.isNumber(a)&&(a=new Date(a)),i=a,h())}),e.$observe("amFormat",function(a){j=a,h()}),c.$on("$destroy",function(){f()})}}]).filter("amDateFormat",["$window",function(a){"use strict";return function(b,c){return"undefined"==typeof b||null===b?"":(!isNaN(parseFloat(b))&&isFinite(b)&&(b=new Date(parseInt(b,10))),a.moment(b).format(c))}}]); \ No newline at end of file diff --git a/bower.json b/bower.json index 3a684d9..572206e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-moment", - "version": "0.2.1", + "version": "0.2.2", "description": "Angular.JS directives for Moment.JS (timeago alternative)", "author": "Uri Shaked", "license": "MIT", diff --git a/package.json b/package.json index b3a3b1d..73941fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-moment", - "version": "0.2.1", + "version": "0.2.2", "repository": { "type": "git", "url": "http://github.com/urish/angular-moment.git"