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

Commit c6c3949

Browse files
committed
feat(filter.date): use mediumDate as default
Breaking change! Previously the default was fullDate.
1 parent e175db3 commit c6c3949

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/filters.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ var GET_TIME_ZONE = /[A-Z]{3}(?![+\-])/,
318318
* @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
319319
* number) or ISO 8601 extended datetime string (yyyy-MM-ddTHH:mm:ss.SSSZ).
320320
* @param {string=} format Formatting rules (see Description). If not specified,
321-
* `fullDate` is used.
321+
* `mediumDate` is used.
322322
* @returns {string} Formatted string or the input if input is not recognized as date/millis.
323323
*
324324
* @example
@@ -349,7 +349,7 @@ angularFilter.date = function(date, format) {
349349
parts = [],
350350
fn, match;
351351

352-
format = format || 'fullDate'
352+
format = format || 'mediumDate'
353353
format = $locale.DATETIME_FORMATS[format] || format;
354354
if (isString(date)) {
355355
if (NUMBER_STRING.test(date)) {

test/FiltersSpec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ describe('filter', function() {
225225
});
226226

227227
it('should do basic filter', function() {
228-
expect(date(noon)).toEqual(date(noon, 'fullDate'));
229-
expect(date(noon, '')).toEqual(date(noon, 'fullDate'));
228+
expect(date(noon)).toEqual(date(noon, 'mediumDate'));
229+
expect(date(noon, '')).toEqual(date(noon, 'mediumDate'));
230230
});
231231

232232
it('should accept number or number string representing milliseconds as input', function() {
233-
expect(date(noon.getTime())).toEqual(date(noon.getTime(), 'fullDate'));
234-
expect(date(noon.getTime() + "")).toEqual(date(noon.getTime() + "", 'fullDate'));
233+
expect(date(noon.getTime())).toEqual(date(noon.getTime(), 'mediumDate'));
234+
expect(date(noon.getTime() + "")).toEqual(date(noon.getTime() + "", 'mediumDate'));
235235
});
236236

237237
it('should accept various format strings', function() {
@@ -297,7 +297,7 @@ describe('filter', function() {
297297
it('should be able to parse ISO 8601 dates/times using', function() {
298298
var isoString = '2010-09-03T05:05:08.872Z';
299299
expect(date(isoString)).
300-
toEqual(date(isoString, 'fullDate'));
300+
toEqual(date(isoString, 'mediumDate'));
301301
});
302302

303303
it('should parse format ending with non-replaced string', function() {

0 commit comments

Comments
 (0)