mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-19 03:51:07 +00:00
fix(dateFilter): allow negative millisecond value strings
This commit is contained in:
parent
ac2d06b19d
commit
025c921903
2 changed files with 5 additions and 1 deletions
|
|
@ -260,7 +260,7 @@ var DATE_FORMATS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
|
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
|
||||||
NUMBER_STRING = /^\d+$/;
|
NUMBER_STRING = /^\-?\d+$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc filter
|
* @ngdoc filter
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,10 @@ describe('filters', function() {
|
||||||
toEqual('September 03, 1');
|
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() {
|
it('should format timezones correctly (as per ISO_8601)', function() {
|
||||||
//Note: TzDate's first argument is offset, _not_ timezone.
|
//Note: TzDate's first argument is offset, _not_ timezone.
|
||||||
var utc = new angular.mock.TzDate( 0, '2010-09-03T12:05:08.000Z');
|
var utc = new angular.mock.TzDate( 0, '2010-09-03T12:05:08.000Z');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue