diff options
| -rw-r--r-- | src/filters.js | 10 | ||||
| -rw-r--r-- | test/FiltersSpec.js | 4 |
2 files changed, 3 insertions, 11 deletions
diff --git a/src/filters.js b/src/filters.js index 7db5403c..5b734882 100644 --- a/src/filters.js +++ b/src/filters.js @@ -75,14 +75,8 @@ var DATE_FORMATS = { var DATE_FORMATS_SPLIT = /([^yMdHhmsaZ]*)(y+|M+|d+|H+|h+|m+|s+|a|Z)(.*)/; angularFilter.date = function(date, format) { - var text, fn; - if (!date) return date; - if (!(date instanceof Date)) { - text = parseInt(date, 10); - date = new Date(); - date.setTime(text); - } - text = date.toLocaleDateString(); + if (!(date instanceof Date)) return date; + var text = date.toLocaleDateString(), fn; if (format && isString(format)) { text = ''; var parts = []; diff --git a/test/FiltersSpec.js b/test/FiltersSpec.js index 0c4afbbd..fbaceac6 100644 --- a/test/FiltersSpec.js +++ b/test/FiltersSpec.js @@ -103,6 +103,7 @@ describe('filter', function(){ it('should ignore falsy inputs', function() { expect(filter.date(null)).toEqual(null); expect(filter.date('')).toEqual(''); + expect(filter.date(123)).toEqual(123); }); it('should do basic filter', function() { @@ -122,9 +123,6 @@ describe('filter', function(){ }); - it('should accept miliseconds as date', function(){ - expect(filter.date("123", "yyyy")).toEqual('1969'); - }); }); }); |
