|
|
@@ -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' }
|
|
|
]
|
|
|
},
|
|
|
{
|