Skip to content

Commit 24a54cd

Browse files
committed
feat(units): refactoring grafana#5404
1 parent a7a5f36 commit 24a54cd

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

public/app/core/utils/kbn.js

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -581,37 +581,10 @@ function($, _, moment) {
581581
}
582582
};
583583

584-
// Date and time
585-
kbn.toDateTime = function(size, timeScale) {
586-
var datetime;
587-
if (timeScale === 's') {
588-
datetime = moment.unix(size);
589-
} else {
590-
datetime = moment(size);
591-
}
592-
return datetime;
593-
};
594-
595584
kbn.toDuration = function(size, timeScale) {
596585
return moment.duration(size, timeScale);
597586
};
598587

599-
kbn.valueFormats.dtms = function(size) {
600-
return kbn.toDateTime(size, 'ms').format('YYYY-MM-DD hh:mm:ss');
601-
};
602-
603-
kbn.valueFormats.dts = function(size) {
604-
return kbn.toDateTime(size, 's').format('YYYY-MM-DD hh:mm:ss');
605-
};
606-
607-
kbn.valueFormats.dtfromnowms = function(size) {
608-
return kbn.toDateTime(size, 'ms').fromNow(true);
609-
};
610-
611-
kbn.valueFormats.dtfromnows = function(size) {
612-
return kbn.toDateTime(size, 's').fromNow(true);
613-
};
614-
615588
kbn.valueFormats.dtdurationms = function(size) {
616589
return kbn.toDuration(size, 'ms').humanize();
617590
};
@@ -656,17 +629,8 @@ function($, _, moment) {
656629
{text: 'minutes (m)', value: 'm' },
657630
{text: 'hours (h)', value: 'h' },
658631
{text: 'days (d)', value: 'd' },
659-
]
660-
},
661-
{
662-
text: 'date and time',
663-
submenu: [
664-
{text: 'date and time (ms)', value: 'dtms'},
665-
{text: 'date and time (s)', value: 'dts' },
666-
{text: 'from now (ms)', value: 'dtfromnowms' },
667-
{text: 'from now (s)', value: 'dtfromnows' },
668-
{text: 'duration (ms)', value: 'dtdurationms' },
669-
{text: 'duration (s)', value: 'dtdurations' }
632+
{text: 'duration (ms)', value: 'dtdurationms' },
633+
{text: 'duration (s)', value: 'dtdurations' }
670634
]
671635
},
672636
{

0 commit comments

Comments
 (0)