[date formatter] Display hyphen on null or undefined dates to be consistent with other types

This commit is contained in:
Jonathan Budzenski 2015-10-09 18:06:46 +02:00
parent 0b32f8f40c
commit 07bfa7941b
2 changed files with 3 additions and 3 deletions

View file

@ -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('-');
});
});

View file

@ -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);
});