Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(dateFilter): allow negative millisecond value strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Henning Teek authored and btford committed Oct 1, 2013
1 parent ac2d06b commit 025c921
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ng/filter/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/ng/filter/filtersSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 025c921

Please sign in to comment.