Commit 2704d42b authored by Johannes Bill's avatar Johannes Bill

parse json

parent ff194ce6
{
"0": {
"option": {
"0": "default"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"1": {
"option": {
"0": "default"
},
"dayoption": {
"0": "2"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "12:00"
},
"2": {
"option": {
"0": "default"
},
"dayoption": {
"0": "2"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "13:00",
"opening_to": "18:00"
},
"3": {
"option": {
"0": "default"
},
"dayoption": {
"0": "8"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"4": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "3"
},
"repeatoption": {
"0": "3"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"5": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "4"
},
"repeatoption": {
"0": "14"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "02.01",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"6": {
"option": {
"0": "season"
},
"dayoption": {
"0": "5"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "25.05",
"opening_day_to": "30.11",
"opening_from": "9:00",
"opening_to": "18:00"
},
"7": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "0"
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"8": {
"option": {
"0": "vacation"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "25.08",
"opening_day_to": "10.09",
"opening_from": "9:00",
"opening_to": "18:00"
}
}
\ No newline at end of file
var tmUtils = require('./timeUtils');
var now = new Date();
var _epochStart = new Date();
_epochStart.setDate(_epochStart.getDate() - 14);
var _epochEnd = new Date(_epochStart.getTime() + 60 * 24 * 3600000);
function calculateOpeningHours(json) {
var jsonIncl = json["include"];
for(var key in jsonIncl) {
var dateA = getOpeningHours(jsonIncl[key]);
console.log(key, dateA);
}
}
function getDaySpan(dayoption) {
if(dayoption < 7) return [dayoption, dayoption];
switch(dayoption) {
case 7:
return [0, 0];
case 8:
return [0, 7];
case 9:
return [1, 5];
case 10:
return [1, 6];
default:
throw "Invalid day option";
}
}
function parseTime(time) {
var split = time.split(":");
return {
h: parseInt(split[0]),
m: parseInt(split[1])
}
}
function parseDate(date) {
if(date.length == 0)
return null;
var year = now.getFullYear();
var split = date.split(".");
var month = parseInt(split[1]);
var day = parseInt(split[0]);
return new Date(year, month, day);
}
function getOpeningHours(json) {
var dayoption = parseInt(json["dayoption"]["0"]);
var daySpan = getDaySpan(dayoption);
var option = json["option"]["0"];
var startDate = parseDate(json["opening_day_from"]) || _epochStart;
var endDate = parseDate(json["opening_day_to"]) || _epochEnd;
var timeFrom = parseTime(json["opening_from"]);
var timeTill = parseTime(json["opening_to"]);
switch(option) {
case "default":
return tmUtils.standardFromTillDay(daySpan[0], daySpan[1], timeFrom, timeTill, _epochStart, _epochEnd, 7);
case "season":
return tmUtils.standardFromTillDay(daySpan[0], daySpan[1], timeFrom, timeTill, startDate, endDate, 7);
case "repeatable":
var repeatOption = parseInt(json["repeatoption"]["0"]);
var noInMonth;
if(repeatOption <= 4) noInMonth = repeatOption;
else if(repeatOption == 30) noInMonth = -1;
if(noInMonth)
return tmUtils.cyclicFromTillDay(daySpan[0], daySpan[1], noInMonth,timeFrom, timeTill, startDate, endDate);
switch (repeatOption) {
case 14:
case 21:
case 28:
return tmUtils.standardFromTillDay(daySpan[0], daySpan[1], timeFrom, timeTill, startDate, endDate, repeatOption);
default:
throw "invalid repeat option";
}
}
}
calculateOpeningHours(require('./testData/data.json'));
\ No newline at end of file
var utils = require('./timeUtils');
var tmUtils = require('./timeUtils');
//gibt zu betrachtenden Zeitraum an.
var _epochStart = new Date(2014, 5, 24, 0);
......@@ -17,16 +17,16 @@ console.log("epochEnd ", _epochEnd);
//console.log(workday);
var t1 = utils.cyclicFromTillDay(1, 1, 1, {h: 9, m: 0}, {h: 0, m: 0}, _epochStart, _epochEnd);
var t2 = utils.cyclicFromTillDay(2, 2, 1, {h: 0, m: 0}, {h: 18, m: 29}, _epochStart, _epochEnd);
var t1 = tmUtils.cyclicFromTillDay(1, 1, 1, {h: 9, m: 0}, {h: 0, m: 0}, _epochStart, _epochEnd);
var t2 = tmUtils.cyclicFromTillDay(2, 2, 1, {h: 0, m: 0}, {h: 18, m: 29}, _epochStart, _epochEnd);
t1 = utils.standardFromTillDay(3,3, {h: 21, m: 0}, {h: 0, m: 0}, _epochStart, _epochEnd, 7);
t2 = utils.standardFromTillDay(4,4, {h: 0, m: 0}, {h: 18, m: 0}, _epochStart, _epochEnd, 7);
t1 = tmUtils.standardFromTillDay(3,3, {h: 21, m: 0}, {h: 0, m: 0}, _epochStart, _epochEnd, 7);
t2 = tmUtils.standardFromTillDay(4,4, {h: 0, m: 0}, {h: 18, m: 0}, _epochStart, _epochEnd, 7);
console.log(t1);
console.log(t2);
var t = utils.orOperator([t1, t2]);
var t = tmUtils.orOperator([t1, t2, tmUtils.singleDay(new Date())]);
console.log(t);
console.log(utils.mergeOverlaps(t));
//console.log(utils.orOperator([t,t2]));
\ No newline at end of file
console.log(tmUtils.mergeOverlaps(t));
//console.log(tmUtils.orOperator([t,t2]));
\ No newline at end of file
{
"include": {
"0": {
"option": {
"0": "default"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"1": {
"option": {
"0": "default"
},
"dayoption": {
"0": "2"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "12:00"
},
"2": {
"option": {
"0": "default"
},
"dayoption": {
"0": "2"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "13:00",
"opening_to": "18:00"
},
"3": {
"option": {
"0": "default"
},
"dayoption": {
"0": "8"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"4": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "3"
},
"repeatoption": {
"0": "3"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"5": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "4"
},
"repeatoption": {
"0": "14"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "02.01",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"6": {
"option": {
"0": "season"
},
"dayoption": {
"0": "5"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "25.05",
"opening_day_to": "30.11",
"opening_from": "9:00",
"opening_to": "18:00"
},
"7": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "0"
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"8": {
"option": {
"0": "vacation"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "25.08",
"opening_day_to": "10.09",
"opening_from": "9:00",
"opening_to": "18:00"
}
},
"exclude": {
"0": {
"option": {
"0": "default"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"1": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": "3"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"2": {
"option": {
"0": "season"
},
"dayoption": {
"0": "8"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.01",
"opening_day_to": "01.02",
"opening_from": "",
"opening_to": ""
},
"3": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "121"
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"4": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "122"
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"5": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "123"
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"6": {
"option": {
"0": "default"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"7": {
"option": {
"0": "vacation"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.10",
"opening_day_to": "09.10",
"opening_from": "",
"opening_to": ""
}
}
}
{
"f86608fb-16aa-4c70-9d57-0b5cac1a9618": {
},
"4ae7b6cb-07e8-4184-a00b-9db001f55bd3": {
"0": {
"value": ""
}
},
"f64563c6-c102-4836-a5f7-8f9246fcceef": {
"option": {
"0": "direktvermarkter-mit-geschaeft",
"1": "premium"
},
"select": "1"
},
"f62d066f-bf0d-42e2-a7ae-6f926fbb49d7": {
"0": {
"value": ""
}
},
"915f382b-51fc-48ba-93e0-152040f8f0e4": {
"0": {
"value": ""
}
},
"1b99ac64-7879-4802-80d9-0de99613efc9": {
"option": {
"0": "premium"
},
"check": "1"
},
"8cf3f417-4d1c-4795-87de-42124dcb2c20": {
"option": {
"0": "premium"
},
"select": "1"
},
"f118eeff-e254-4155-8e23-8149cb8b5eea": {
"0": {
"value": "Testhof"
}
},
"dbc68015-df76-42ed-a033-503b87e35685": {
"check": "1"
},
"0b13b5c0-bec6-445c-bdf2-e201ba0d43e4": {
"file": "",
"title": "",
"link": "",
"target": "0",
"rel": "",
"lightbox_image": "",
"spotlight_effect": "",
"caption": ""
},
"17709bb7-acf7-4ef5-8b26-4ed4fe63f8c9": {
"0": {
"value": ""
}
},
"3d305054-e356-4c09-8f4c-7795433a4589": {
"file": "",
"title": "",
"link": "",
"target": "0",
"rel": "",
"lightbox_image": "",
"spotlight_effect": "",
"caption": ""
},
"e8c1fdc9-50e0-4a9b-994a-f48f738dac64": {
},
"ed9cdd4c-ae8b-4ecb-bca7-e12a5153bc02": {
"0": {
"value": "Testen auf dem Testhof"
}
},
"514ccde0-0a79-4594-8b72-b906ee4cede9": {
"0": {
"opening_day": "",
"opening_from": "",
"opening_to": ""
}
},
"810a6deb-46f2-4fa8-b779-bb5c2a6b5577": {
"0": {
"option": {
"0": "default"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"1": {
"option": {
"0": "default"
},
"dayoption": {
"0": "2"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "12:00"
},
"2": {
"option": {
"0": "default"
},
"dayoption": {
"0": "2"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "13:00",
"opening_to": "18:00"
},
"3": {
"option": {
"0": "default"
},
"dayoption": {
"0": "8"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"4": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "3"
},
"repeatoption": {
"0": "3"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"5": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "4"
},
"repeatoption": {
"0": "14"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "02.01",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
},
"6": {
"option": {
"0": "season"
},
"dayoption": {
"0": "5"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "25.05",
"opening_day_to": "30.11",
"opening_from": "9:00",
"opening_to": "18:00"
},
"7": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "0"
},
"opening_day_from": "",
"opening_day_to": "",
"opening_from": "9:00",
"opening_to": "18:00"
}
},
"bb74c170-b06f-4d2b-ab88-2f6bf9ce8068": {
"0": {
"option": {
"0": "repeatable"
},
"dayoption": {
"0": "1"
},
"repeatoption": {
"0": "3"
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"1": {
"option": {
"0": "season"
},
"dayoption": {
"0": "8"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.01",
"opening_day_to": "01.02",
"opening_from": "",
"opening_to": ""
},
"2": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "121"
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"3": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "122"
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"4": {
"option": {
"0": "holiday"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": "123"
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"5": {
"option": {
"0": "default"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.01",
"opening_day_to": "",
"opening_from": "",
"opening_to": ""
},
"6": {
"option": {
"0": "vacation"
},
"dayoption": {
"0": "0"
},
"repeatoption": {
"0": ""
},
"holidayoption": {
"0": ""
},
"opening_day_from": "01.10",
"opening_day_to": "09.10",
"opening_from": "",
"opening_to": ""
}
},
"7ac7d682-2862-443b-83bd-8a3cf837ad8e": {
"option": {
"0": "0"
}
},
"6b3b589d-8060-4193-92b9-ce430d96cfdd": {
"0": {
"value": "Immer und t\u00e4glich ge\u00f6ffnet, au\u00dfer es ist niemand da."
}
},
"65359d5a-faca-46b8-8644-767d382d8b9b": {
"option": {
"0": "hinweis"
},
"check": "1"
},
"533ea2dd-e37d-4add-aa73-ad8419040c22": {
"0": {
"value": "Immer und t\u00e4glich ge\u00f6ffnet, au\u00dfer es ist niemand da."
}
},
"6d9ab971-f969-499b-bb6b-9b87b601a961": {
"check": "1"
},
"f67464f3-4475-46a9-a262-11c8a777865d": {
"0": {
"value": "Regoistart GmbH"
}
},
"1d0a9c64-78d4-4767-8617-c8a3a66fc770": {
"0": {
"value": ""
}
},
"05192b86-fc84-43cb-81d3-ab804086a873": {
"0": {
"value": ""
}
},
"d230a60f-0016-4180-b83a-13e4fd938328": {
"0": {
"value": "regionalkauf.com"
}
},
"c70daef6-ffee-40ef-ba29-3d0065a5aaf5": {
},
"a77f06fc-1561-453c-a429-8dd05cdc29f5": {
"0": {
"value": "<p>Bienenhonig, Met, Propolis, Bl\u00fctenpollen. sm\u00f6rrebr\u00f6d, smoerrebroed roemtoemtoemt\u00f6m.<\/p>"
}
},
"1a85a7a6-2aba-4480-925b-6b97d311ee6c": {
"0": {
"value": "<p>Bienenhonig, Met, Propolis, Bl\u00fctenpollen. supercalafragalisticexpialadoshus, s\u00fcpercalafragalisticexpialad\u00f6shus<\/p>"
}
},
"efd91873-dce0-48fd-b40e-5bc0e9599f3e": {
},
"9ca9fc28-03f8-472d-b49f-8e2513cc8740": {
"file": "images\/regionalkaufapp\/unternehmen\/logo_basis.png",
"title": "",
"link": "",
"target": "0",
"rel": "",
"lightbox_image": "",
"spotlight_effect": "",
"caption": "",
"width": 144,
"height": 145
},
"ffcc1c50-8dbd-4115-b463-b43bdcd44a57": {
"file": "images\/regionalkaufapp\/unternehmen\/logo_basis.png",
"title": "",
"link": "",
"target": "0",
"rel": "",
"lightbox_image": "",
"spotlight_effect": "",
"caption": "",
"width": 144,
"height": 145
},
"e8f08959-19ff-4cfa-ba37-bc42414eeb45": {
"value": "\/allgemein",
"title": "Die Bilder sind in Vorbereitung."
},
"051452fe-692b-4ce2-8567-7dc4d0343fee": {
"url": "",
"width": "640",
"height": "360",
"autoplay": "0"
},
"b68108e0-e49b-420d-97ec-d7c88af2b01a": {
"file": "",
"hits": "0",
"download_limit": "",
"size": 0
},
"92fda174-119b-4ee7-b14c-98c7f65224de": {
},
"4339a108-f907-4661-9aab-d6f3f00e736e": {
"0": {
"value": "Dr.Theobald-Schrems-Stra\u00dfe 4"
}
},
"ea0666d7-51e3-4e52-8617-25e3ad61f8b8": {
"0": {
"value": "93055"
}
},
"90a18889-884b-4d53-a302-4e6e4595efa0": {
"0": {
"value": "Regensburg"
}
},
"160bd40a-3e0e-48de-b6cd-56cdcc9db892": {
"location": "49.0146337, 12.111873899999978"
},
"9ff517f0-d029-4e85-a411-fdb2bbae3b8c": {
"location": "49.0146337, 12.111873899999978"
},
"33bfd53b-1f42-4628-bb3d-461cacecdd84": {
"0": {
"value": "12.111873899999978, 49.0146337"
}
},
"7516ee89-8702-4675-806b-58fe5bc56305": {
},
"b870164b-fe78-45b0-b840-8ebceb9b9cb6": {
"0": {
"value": "0941 56959760"
}
},
"272860a4-9ba0-4303-b2d3-77abb8d6fd42": {
"0": {
"value": "0941 56959768"
}
},
"5dcfa5ab-3769-4c5e-8cd2-1ac91643be70": {
"0": {
"value": "0941 56959768"
}
},
"8a91aab2-7862-4a04-bd28-07f1ff4acce5": {
"0": {
"value": "0941 56959769"
}
},
"3f15b5e4-0dea-4114-a870-1106b85248de": {
"0": {
"value": "mb@regiostart.com",
"text": "",
"subject": "",
"body": ""
}
},
"0b3d983e-b2fa-4728-afa0-a0b640fa34dc": {
"0": {
"value": "http:\/\/regiostart.com",
"text": "",
"target": "1",
"custom_title": "",
"rel": ""
}
},
"b7628b63-d551-4b14-ac70-27cf0c6e95fc": {
"0": {
"value": "http:\/\/myreg.io\/g"
}
},
"2081965c-c781-4ae1-99c3-54b959145cfe": {
"value": "1"
},
"8eeeb531-0dc3-415a-8f4a-c7f88d1ac627": {
"value": "1"
},
"9bd1d374-6a54-4054-be1e-87839eb24fb6": {
},
"7056f1d2-5253-40b6-8efd-d289b10a8c69": {
"item": {
"0": "2423"
}
},
"6eaab8b7-b4f5-4d3c-8193-db3542aec0a5": {
},
"c59ac5ce-2011-44b9-846f-e9cb73857b33": {
},
"e2221aa5-853b-4a8c-aeb1-53a97efa6995": {
},
"9eeb4b7d-f289-4137-91ea-5275bb3376a7": {
},
"23685df7-81bb-4c25-a14a-18e2c42a4caf": {
},
"cf6dd846-5774-47aa-8ca7-c1623c06e130": {
"votes": "1",
"value": "5.0000"
},
"cffd7b0a-317a-4cf9-852e-65fd31526a53": {
"votes": "1"
}
}
\ No newline at end of file
......@@ -34,10 +34,10 @@ function _standard(day, timeFrom, timeUntil, epochStart, epochEnd, distanceDays)
return _cyclicInterval(startDate, endDate, distanceDays * 24 * 3600000, epochStart, epochEnd);
}
function standardFromTillDay(dayFrom, dayTill, timeFrom, timeUntil, epochStart, epochEnd, distanceDays) {
function standardFromTillDay(dayFrom, dayTill, timeFrom, timeUntil, epochStart, epochEnd, daysDistance) {
timeUntil = transformTill(timeFrom, timeUntil);
var firstDays = _standard(dayFrom, timeFrom, timeUntil, epochStart, epochEnd, distanceDays);
var firstDays = _standard(dayFrom, timeFrom, timeUntil, epochStart, epochEnd, daysDistance);
var result = firstDays.slice();
for(var offset = 1; offset <= dayTill - dayFrom; offset++) {
......@@ -155,6 +155,13 @@ function _getNextNoInMonthOccurence(day, startDate, noInMonth) {
return startDate;
}
function singleDay(date) {
var startDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
var endDate = new Date(startDate);
endDate.setDate(endDate.getDate() + 1);
return [[startDate, endDate]];
}
function orOperator(intervals) {
var result = [];
......@@ -246,8 +253,8 @@ function andNotOperator(interval1, interval2) {
}
module.exports.standardFromTillDay = standardFromTillDay;
module.exports.cyclic = cyclic;
module.exports.cyclicFromTillDay = cyclicFromTillDay;
module.exports.singleDay = singleDay;
module.exports.orOperator = orOperator;
module.exports.andOperator = andOperator;
module.exports.andNotOperator = andNotOperator;
......
endzeit kleiner anfangszeit ==> endzeit + 24
\ No newline at end of file
feiertage defaultmaessig abziehen
verbindung feiertag - region
\ 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