mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
feat(filter.date): use mediumDate as default
Breaking change! Previously the default was fullDate.
This commit is contained in:
parent
e175db37c6
commit
c6c3949b14
2 changed files with 7 additions and 7 deletions
|
|
@ -318,7 +318,7 @@ var GET_TIME_ZONE = /[A-Z]{3}(?![+\-])/,
|
|||
* @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
|
||||
* number) or ISO 8601 extended datetime string (yyyy-MM-ddTHH:mm:ss.SSSZ).
|
||||
* @param {string=} format Formatting rules (see Description). If not specified,
|
||||
* `fullDate` is used.
|
||||
* `mediumDate` is used.
|
||||
* @returns {string} Formatted string or the input if input is not recognized as date/millis.
|
||||
*
|
||||
* @example
|
||||
|
|
@ -349,7 +349,7 @@ angularFilter.date = function(date, format) {
|
|||
parts = [],
|
||||
fn, match;
|
||||
|
||||
format = format || 'fullDate'
|
||||
format = format || 'mediumDate'
|
||||
format = $locale.DATETIME_FORMATS[format] || format;
|
||||
if (isString(date)) {
|
||||
if (NUMBER_STRING.test(date)) {
|
||||
|
|
|
|||
|
|
@ -225,13 +225,13 @@ describe('filter', function() {
|
|||
});
|
||||
|
||||
it('should do basic filter', function() {
|
||||
expect(date(noon)).toEqual(date(noon, 'fullDate'));
|
||||
expect(date(noon, '')).toEqual(date(noon, 'fullDate'));
|
||||
expect(date(noon)).toEqual(date(noon, 'mediumDate'));
|
||||
expect(date(noon, '')).toEqual(date(noon, 'mediumDate'));
|
||||
});
|
||||
|
||||
it('should accept number or number string representing milliseconds as input', function() {
|
||||
expect(date(noon.getTime())).toEqual(date(noon.getTime(), 'fullDate'));
|
||||
expect(date(noon.getTime() + "")).toEqual(date(noon.getTime() + "", 'fullDate'));
|
||||
expect(date(noon.getTime())).toEqual(date(noon.getTime(), 'mediumDate'));
|
||||
expect(date(noon.getTime() + "")).toEqual(date(noon.getTime() + "", 'mediumDate'));
|
||||
});
|
||||
|
||||
it('should accept various format strings', function() {
|
||||
|
|
@ -297,7 +297,7 @@ describe('filter', function() {
|
|||
it('should be able to parse ISO 8601 dates/times using', function() {
|
||||
var isoString = '2010-09-03T05:05:08.872Z';
|
||||
expect(date(isoString)).
|
||||
toEqual(date(isoString, 'fullDate'));
|
||||
toEqual(date(isoString, 'mediumDate'));
|
||||
});
|
||||
|
||||
it('should parse format ending with non-replaced string', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue