diff options
| author | Henning Teek | 2013-08-23 12:48:32 +0200 |
|---|---|---|
| committer | Brian Ford | 2013-10-01 10:18:03 -0700 |
| commit | 025c92190376414c15f15fd20a75b41489a4e70a (patch) | |
| tree | 40ffb7c5f7dfad1456ecc2d2006798391098163b | |
| parent | ac2d06b19d8118cf482075f39088f41dfa318acf (diff) | |
| download | angular.js-025c92190376414c15f15fd20a75b41489a4e70a.tar.bz2 | |
fix(dateFilter): allow negative millisecond value strings
| -rw-r--r-- | src/ng/filter/filters.js | 2 | ||||
| -rw-r--r-- | test/ng/filter/filtersSpec.js | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ng/filter/filters.js b/src/ng/filter/filters.js index 8afe2a0f..d387f668 100644 --- a/src/ng/filter/filters.js +++ b/src/ng/filter/filters.js @@ -260,7 +260,7 @@ var DATE_FORMATS = { }; var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/, - NUMBER_STRING = /^\d+$/; + NUMBER_STRING = /^\-?\d+$/; /** * @ngdoc filter diff --git a/test/ng/filter/filtersSpec.js b/test/ng/filter/filtersSpec.js index 59883799..cd83437f 100644 --- a/test/ng/filter/filtersSpec.js +++ b/test/ng/filter/filtersSpec.js @@ -246,6 +246,10 @@ describe('filters', function() { toEqual('September 03, 1'); }); + it('should accept negative numbers as strings', function() { + expect(date('-1')).toEqual('Dec 31, 1969'); + }); + it('should format timezones correctly (as per ISO_8601)', function() { //Note: TzDate's first argument is offset, _not_ timezone. var utc = new angular.mock.TzDate( 0, '2010-09-03T12:05:08.000Z'); |
