Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/@angular/common/src/pipes/date_pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class DatePipe implements PipeTransform {
transform(value: any, pattern: string = 'mediumDate'): string {
let date: Date;

if (isBlank(value)) return null;
if (isBlank(value) || value !== value) return null;

if (typeof value === 'string') {
value = value.trim();
Expand Down
2 changes: 2 additions & 0 deletions modules/@angular/common/test/pipes/date_pipe_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export function main() {

it('should return null for empty string', () => expect(pipe.transform('')).toEqual(null));

it('should return null for NaN', () => expect(pipe.transform(Number.NaN)).toEqual(null));

it('should support ISO string without time',
() => { expect(() => pipe.transform(isoStringWithoutTime)).not.toThrow(); });

Expand Down