diff --git a/packages/abc/st/st-data-source.ts b/packages/abc/st/st-data-source.ts index e3fb81ad4..196cd9b6e 100644 --- a/packages/abc/st/st-data-source.ts +++ b/packages/abc/st/st-data-source.ts @@ -239,7 +239,10 @@ export class STDataSource { text = this.currencySrv.format(value, col.currency?.format); break; case 'date': - text = value === col.default ? col.default : this.datePipe.transform(value, col.dateFormat); + text = + value == null || value === col.default || (typeof value === 'number' && value <= 0) + ? col.default + : this.datePipe.transform(value, col.dateFormat); break; case 'yn': text = this.ynPipe.transform(value === col.yn!.truth, col.yn!.yes!, col.yn!.no!, col.yn!.mode!, false); diff --git a/packages/abc/st/test/st-data-source.spec.ts b/packages/abc/st/test/st-data-source.spec.ts index 3eb926652..ecc15aea7 100644 --- a/packages/abc/st/test/st-data-source.spec.ts +++ b/packages/abc/st/test/st-data-source.spec.ts @@ -791,6 +791,14 @@ describe('abc: table: data-souce', () => { done(); }); }); + it('should be return default value when is 0 timestamp', done => { + options.columns[0] = { index: 'date', type: 'date', default: '-' } as _STColumn; + options.data = [{ date: 0 }, { date: new Date() }]; + srv.process(options).subscribe(res => { + expect(res.list[0]._values[0].text).toBe('-'); + done(); + }); + }); }); it('via yn', done => { options.columns[0].type = 'yn';