From 2cb83cf19dce67c5191b08b6e9e58f7218ad984a Mon Sep 17 00:00:00 2001 From: carl bergquist Date: Wed, 16 Dec 2015 16:32:55 +0100 Subject: [PATCH] style(graph.tooltip): moves checkdate logic inside each method. I find it easier to follow and checkdate didnt do much. --- public/app/features/dashboard/dashboardSrv.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 7923e1071cb..559adff5c54 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -214,9 +214,7 @@ function (angular, $, _, moment) { }; p.formatDate = function(date, format) { - - date = this.checkDate(date); - + date = moment.isMoment(date) ? date : moment(date); format = format || 'YYYY-MM-DD HH:mm:ss'; return this.timezone === 'browser' ? @@ -225,21 +223,13 @@ function (angular, $, _, moment) { }; p.getRelativeTime = function(date) { - - date = this.checkDate(date); + date = moment.isMoment(date) ? date : moment(date); return this.timezone === 'browser' ? moment(date).fromNow() : moment.utc(date).fromNow(); }; - p.checkDate = function(date) { - if (!moment.isMoment(date)) { - date = moment(date); - } - return date; - }; - p._updateSchema = function(old) { var i, j, k; var oldVersion = this.schemaVersion;