Skip to content

Commit

Permalink
Merge pull request #5090 from jbudz/issues/4891
Browse files Browse the repository at this point in the history
[date formatter] Display hyphen on null or undefined dates
  • Loading branch information
jbudz committed Oct 9, 2015
2 parents 3cda9ad + 07bfa79 commit 209951b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ui/public/stringify/__tests__/_date.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('Date Format', function () {
var date = new DateFormat({
pattern: 'dd-MM-yyyy'
});
expect(date.convert(null)).to.be('');
expect(date.convert(undefined)).to.be('');
expect(date.convert(null)).to.be('-');
expect(date.convert(undefined)).to.be('-');
});

});
2 changes: 1 addition & 1 deletion src/ui/public/stringify/types/Date.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ define(function (require) {
this._memoizedPattern = pattern;
this._memoizedConverter = _.memoize(function converter(val) {
if (val === null || val === undefined) {
return '';
return '-';
}
return moment(val).format(pattern);
});
Expand Down

0 comments on commit 209951b

Please sign in to comment.