From 24a54cd95b71d0545262eca3be3ac92370c7d128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 21 Jun 2016 21:08:07 +0200 Subject: [PATCH] feat(units): refactoring #5404 --- public/app/core/utils/kbn.js | 40 ++---------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index ccbb9900b65..83f577b460d 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -581,37 +581,10 @@ function($, _, moment) { } }; - // Date and time - kbn.toDateTime = function(size, timeScale) { - var datetime; - if (timeScale === 's') { - datetime = moment.unix(size); - } else { - datetime = moment(size); - } - return datetime; - }; - kbn.toDuration = function(size, timeScale) { return moment.duration(size, timeScale); }; - kbn.valueFormats.dtms = function(size) { - return kbn.toDateTime(size, 'ms').format('YYYY-MM-DD hh:mm:ss'); - }; - - kbn.valueFormats.dts = function(size) { - return kbn.toDateTime(size, 's').format('YYYY-MM-DD hh:mm:ss'); - }; - - kbn.valueFormats.dtfromnowms = function(size) { - return kbn.toDateTime(size, 'ms').fromNow(true); - }; - - kbn.valueFormats.dtfromnows = function(size) { - return kbn.toDateTime(size, 's').fromNow(true); - }; - kbn.valueFormats.dtdurationms = function(size) { return kbn.toDuration(size, 'ms').humanize(); }; @@ -656,17 +629,8 @@ function($, _, moment) { {text: 'minutes (m)', value: 'm' }, {text: 'hours (h)', value: 'h' }, {text: 'days (d)', value: 'd' }, - ] - }, - { - text: 'date and time', - submenu: [ - {text: 'date and time (ms)', value: 'dtms'}, - {text: 'date and time (s)', value: 'dts' }, - {text: 'from now (ms)', value: 'dtfromnowms' }, - {text: 'from now (s)', value: 'dtfromnows' }, - {text: 'duration (ms)', value: 'dtdurationms' }, - {text: 'duration (s)', value: 'dtdurations' } + {text: 'duration (ms)', value: 'dtdurationms' }, + {text: 'duration (s)', value: 'dtdurations' } ] }, {