Commit ca60bfe9 authored by Johannes Bill's avatar Johannes Bill

fixed error propagaytion

parent 3c7ade5d
...@@ -16,3 +16,5 @@ function getOHIndex(incl, excl, date, plz, cb) { ...@@ -16,3 +16,5 @@ function getOHIndex(incl, excl, date, plz, cb) {
} }
module.exports.getOHIndex = getOHIndex; module.exports.getOHIndex = getOHIndex;
module.exports.dataArray = dateArray;
module.exports.dateView = dateView;
...@@ -176,5 +176,35 @@ function getPropperEpochSpan(now) { ...@@ -176,5 +176,35 @@ function getPropperEpochSpan(now) {
return [epochStart, epochEnd]; return [epochStart, epochEnd];
} }
function asString(data, now) {
var mNow = moment(now);
var open = false;
var nowT = now.getTime();
var idx = 0;
while(nowT >= data[idx][0].getTime() && idx < data.length) {
if(data[idx][1].getTime() >= nowT)
open = true;
idx++;
}
if(open) {
idx--;
return mNow.format("dddd") + ", jetzt bis " + moment(data[idx][1]).format("LT") + " geöffnet";
}
else {
var retStr = "Jetzt nicht geöffnet, ";
if(idx == data.length) {
return retStr + "nächter Öffnungstermin unbekannt";
}
else {
var nextM = moment(data[idx][0]);
return retStr + "wieder geöffnet am " + nextM.format("dddd") + ", " + nextM.format("l") + " ab " + nextM.format("LT");
}
}
}
module.exports.asString = asString;
module.exports.weekView = createWeekView;
module.exports.monthView = create3MonthView;
module.exports.getView = getView; module.exports.getView = getView;
module.exports.getPropperEpochSpan = getPropperEpochSpan; module.exports.getPropperEpochSpan = getPropperEpochSpan;
\ No newline at end of file
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