diff options
| author | Igor Minar | 2010-10-23 18:26:47 -0700 |
|---|---|---|
| committer | Igor Minar | 2010-10-23 18:26:47 -0700 |
| commit | 4e9a2aa10ec6e84377aebd37fd3ae44af3d9423a (patch) | |
| tree | 81c8e915b888f697eefb5380f8b728e66b68516a | |
| parent | 4fc21414581be1825a7ffb5cfda98eda501652d0 (diff) | |
| download | angular.js-4e9a2aa10ec6e84377aebd37fd3ae44af3d9423a.tar.bz2 | |
Revert "added support for treating numbers as date in miliseconds"
This reverts commit 1391f19fb49275af59230afef51b472c58d7818c.
| -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'); - }); }); }); |
