From 02f376b6d335ff9e717a293cb514422e3d5ee7dd Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Thu, 6 Mar 2014 19:58:04 +0200 Subject: [PATCH] Hackish way to show dates as dates in the table and timestamps as date+timestamp. --- rd_ui/app/scripts/visualizations/table.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rd_ui/app/scripts/visualizations/table.js b/rd_ui/app/scripts/visualizations/table.js index 98ee06d9..5b5835e3 100644 --- a/rd_ui/app/scripts/visualizations/table.js +++ b/rd_ui/app/scripts/visualizations/table.js @@ -63,7 +63,13 @@ columnDefinition['formatParameter'] = 2; } else if (moment.isMoment(exampleData)) { columnDefinition['formatFunction'] = function(value) { - return value.format("DD/MM/YY HH:mm"); + // TODO: this is very hackish way to determine if we need + // to show the value as a time or date only. Better solution + // is to complete #70 and use the information it returns. + if (value._i.match(/^\d{4}-\d{2}-\d{2}T/)) { + return value.format("DD/MM/YY HH:mm"); + } + return value.format("DD/MM/YY"); } } }