Bug fixes

This commit is contained in:
Javier Goizueta 2018-10-03 23:12:58 +02:00
parent c588d4139e
commit 99b62edcbd

View File

@ -32,7 +32,7 @@ function timeExpression(t, tz) {
function epochExpression(epoch) {
/* jshint maxcomplexity:8 */ // goddammit linter, I like this as is!!
const format = /^(\d\d\d\d)(?:\-?(\d\d)(?:\-?(\d\d)(?:[T\s]?(\d\d)(?:(\d\d)(?:\:(\d\d))?)?)?)?)?$/;
const match = epoch.match(format) || [];
const match = (epoch || '').match(format) || [];
const year = match[1] || '0001';
const month = match[2] || '01';
const day = match[3] || '01';
@ -165,7 +165,7 @@ const cyclicParts = {
function cyclicSqlExpr(params) {
const column = timeExpression(params.time, params.timezone);
return isoParts[params.grouping].replace(/\$t/g, column);
return cyclicParts[params.grouping].replace(/\$t/g, column);
}
const ACCEPTED_PARAMETERS = ['time', 'grouping', 'timezone', 'count', 'starting', 'format'];
@ -256,7 +256,7 @@ const CLASSIFIERS = {
};
function isCyclic(groupBy) {
return groupBy.match(/.+By.+/);
return VALID_CYCLIC_GROUPINGS.includes(groupBy);
}
function classifierFor(params) {