Commit e6122ba1 authored by Johannes Bill's avatar Johannes Bill

raw events for new calendar

parent 611f1301
var dateArray = require('./lib/dateArray');
var dateView = require('./lib/dateView');
var splitMidnight = require('./lib/timeUtils').splitMidnight;
function mapEvents(dataObj) {
if (dataObj.intervals) {
return splitMidnight(dataObj.intervals).map(function(evt) {
return {
startDate: evt[0],
endDate: evt[1]
}
})
}
}
function transform(x) {
var res = [];
for (var i = 0; i < x.length; i++) {
......@@ -9,10 +24,6 @@ function transform(x) {
return res;
}
var dateArray = require('./lib/dateArray');
var dateView = require('./lib/dateView');
function getOHIndex(info, today, cb) {
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
......@@ -41,7 +52,8 @@ function getFull(info, now, cb) {
isOpen: short.isOpen,
text: short.text,
status: short.status,
weekView: dateView.weekViewData(dataObj, now)
weekView: dateView.weekViewData(dataObj, now),
events: mapEvents(dataObj)
};
cb(null, res);
})
......
......@@ -286,6 +286,7 @@ function wrapper(_epochSpan) {
}
function getOpeningHoursDatespan(data) {
// TODO JB remove entries beyond epochespan
var from = new Date(data['opening_date_from']);
var to = new Date(data['opening_date_to']);
if(!from || !to) {
......
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