mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
Revert "added support for treating numbers as date in miliseconds"
This reverts commit 1391f19fb4.
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user