mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed issue with date parsing, now saved absolute range should work again
This commit is contained in:
parent
915f2a4914
commit
533e176566
@ -3,8 +3,9 @@ define([
|
|||||||
'underscore',
|
'underscore',
|
||||||
'jquery',
|
'jquery',
|
||||||
'config',
|
'config',
|
||||||
|
'kbn'
|
||||||
],
|
],
|
||||||
function (angular, _, $, config) {
|
function (angular, _, $, config, kbn) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var module = angular.module('kibana.services');
|
var module = angular.module('kibana.services');
|
||||||
@ -37,19 +38,21 @@ function (angular, _, $, config) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.translateTime = function(date) {
|
this.translateTime = function(date) {
|
||||||
if (_.isDate(date)) {
|
if (_.isString(date)) {
|
||||||
return $.plot.formatDate(date, '%H%:%M_%Y%m%d');
|
if (date === 'now') {
|
||||||
|
return 'now';
|
||||||
|
}
|
||||||
|
else if (date.indexOf('now') > 0) {
|
||||||
|
date = date.substring(3);
|
||||||
|
date = date.replace('m', 'min');
|
||||||
|
date = date.replace('M', 'mon');
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
date = kbn.parseDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (date === 'now') {
|
return $.plot.formatDate(date, '%H%:%M_%Y%m%d');
|
||||||
return 'now';
|
|
||||||
}
|
|
||||||
|
|
||||||
date = date.substring(3);
|
|
||||||
date = date.replace('m', 'min');
|
|
||||||
date = date.replace('M', 'mon');
|
|
||||||
|
|
||||||
return date;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.match = function(targets, graphiteTargetStr) {
|
this.match = function(targets, graphiteTargetStr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user