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