Commit b9aa8880 authored by Johannes Bill's avatar Johannes Bill

fixed issue with hours over midnight

parent cf1da512
......@@ -28,7 +28,8 @@ module.exports = function (config) {
}),
maybeToday: resultMaybe.filter(function (elem) {
return elem[0].getTime() >= today.getTime() && elem[1].getTime() <= tomorrow.getTime();
})
}),
debugInfo: result.debugInfo
};
cb(null, fResult);
......
......@@ -7,6 +7,8 @@ var excludeString = "bb74c170-b06f-4d2b-ab88-2f6bf9ce8068";
var maybeIncludeString = "e85aacb0-bd79-4091-a271-85de0cebf66d";
function wrapper(_epochSpan) {
var debugInfo = '';
var epochSpan;
var year;
var startYear;
......@@ -63,6 +65,7 @@ function wrapper(_epochSpan) {
var maybeIntervals = buildOpeningHours([json.maybe], holidayIntervals);
ret.maybeIntervals = tmUtils.andNotOp(maybeIntervals, ret.intervals);
}
ret.debugInfo = debugInfo;
cb(null, ret);
}
......@@ -225,7 +228,7 @@ function wrapper(_epochSpan) {
var startDate, endDate;
if (!end) {
console.log('no endDate for dateSpan');
debugInfo += 'no endDate for dateSpan';
startDate = new Date(startYear, start[1] - 1, start[0]);
endDate = new Date(startYear + 2, start[1] - 1, start[0]);
return [[startDate, endDate]];
......
......@@ -512,7 +512,7 @@ function compareDate(date1, date2) {
function getPropperEpochSpan(now) {
var epochStart = new Date(now.getFullYear(), now.getMonth(), -10);
var epochEnd = new Date(now.getFullYear(), now.getMonth() + 3, 1);
var epochEnd = new Date(now.getFullYear(), now.getMonth() + 3, 2);
return [epochStart, epochEnd];
}
......
......@@ -20,7 +20,7 @@ module.exports.getData = function (now, cb) {
// dateArray.setEpocheSpan(epocheSpan);
// connection.query('SELECT name, elements FROM cms_zoo_item WHERE type in ("pos", "company") ORDER BY id', function (err, rows) {
connection.query('SELECT name, type, elements FROM cms_zoo_item WHERE id in (4116)', function (err, rows) {
connection.query('SELECT name, type, elements FROM cms_zoo_item WHERE id in (1793)', function (err, rows) {
console.error(err);
console.log(rows.length);
var result = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment