Do not apply timezone for minute an hour aggregations

This commit is contained in:
Daniel García Aubert
2017-07-12 17:08:55 +02:00
parent b67f6053e8
commit c8286233be
2 changed files with 142 additions and 4 deletions
+9 -4
View File
@@ -403,14 +403,14 @@ Histogram.prototype._buildDateHistogramQuery = function (psql, override, callbac
_aggregation: _aggregation,
_start: getBinStart(override),
_end: getBinEnd(override),
_timezone: getTimezone(_timezone)
_timezone: getTimezone(_timezone, _aggregation)
});
} else {
dateBasicsQuery = dateBasicsQueryTpl({
_query: _query,
_column: _column,
_aggregation: _aggregation,
_timezone: getTimezone(_timezone)
_timezone: getTimezone(_timezone, _aggregation)
});
}
@@ -429,7 +429,7 @@ Histogram.prototype._buildDateHistogramQuery = function (psql, override, callbac
_query: _query,
_column: _column,
_aggregation: _aggregation,
_timezone: getTimezone(_timezone)
_timezone: getTimezone(_timezone, _aggregation)
});
var histogramSql = [
@@ -551,10 +551,15 @@ function getWidth(override) {
return width;
}
function getTimezone(timezone) {
function getTimezone(timezone, aggregation) {
if (!timezone) {
return '0';
}
if (aggregation === 'hour' || aggregation === 'minute') {
return '0';
}
var timezoneInHours = Math.ceil(timezone / 3600);
return '' + timezoneInHours;
}