diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc3c68cb12..6f437fbab99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * **Alerts out of sync**: Saving dashboards with broken alerts causes sync problem[#6576](https://github.com/grafana/grafana/issues/6576) * **Alerting**: Saving an alert with condition "HAS NO DATA" throws an error[#6701](https://github.com/grafana/grafana/issues/6701) * **Config**: Improve error message when parsing broken config file [#6731](https://github.com/grafana/grafana/issues/6731) +* **Table**: Render empty dates as - instead of current date [#6728](https://github.com/grafana/grafana/issues/6728) # 4.0-beta2 (2016-11-21) diff --git a/public/app/plugins/panel/table/renderer.ts b/public/app/plugins/panel/table/renderer.ts index 819471c9470..a18f4422351 100644 --- a/public/app/plugins/panel/table/renderer.ts +++ b/public/app/plugins/panel/table/renderer.ts @@ -47,6 +47,10 @@ export class TableRenderer { if (style.type === 'date') { return v => { + if (v === undefined || v === null) { + return '-'; + } + if (_.isArray(v)) { v = v[0]; } var date = moment(v); if (this.isUtc) { diff --git a/public/app/plugins/panel/table/specs/renderer_specs.ts b/public/app/plugins/panel/table/specs/renderer_specs.ts index 9cf2ba1046b..46789f295d1 100644 --- a/public/app/plugins/panel/table/specs/renderer_specs.ts +++ b/public/app/plugins/panel/table/specs/renderer_specs.ts @@ -68,6 +68,16 @@ describe('when rendering table', () => { expect(html).to.be('