Commit fd4c0558 authored by Johannes Bill's avatar Johannes Bill

refactored

parent 11cafb58
var x = new Date(); var utils = require('./timeUtils');
var y = new Date(x);
y.setDate(1);
//gibt zu betrachtenden Zeitraum an.
var _epochStart = new Date(2014, 5, 24, 0);
var _epochEnd = new Date(_epochStart.getTime() + 100 * 24 * 3600000);
console.log(x); console.log("epochStart", _epochStart);
console.log(y); console.log("epochEnd ", _epochEnd);
\ No newline at end of file
//test
//var a = _cyclicInterval(new Date(2014, 5, 23, 9), new Date(2014, 5, 23, 14), 7 * 24 * 3600 * 1000);
//var b = _cyclicInterval(new Date(2014, 5, 23, 10), new Date(2014, 5, 23, 18), 7 * 24 * 3600 * 1000);
//var c = [[new Date(2014, 5, 23, 13), new Date(2014, 6, 6, 10)]];
//var x = andNotOperator(a, b);
//var y = andNotOperator(a, c);
//console.log(y);
//var workday = standardFromTillDay(1, 6, {h: 9, m: 0}, {h: 11, m: 45}, _epochStart, _epochEnd, 14);
//console.log(workday);
var t = utils.cyclicFromTillDay(1, 5, -1, {h: 9, m: 0}, {h: 18, m: 29}, _epochStart, _epochEnd);
var t2 = utils.cyclicFromTillDay(2, 2, -1, {h: 9, m: 0}, {h: 18, m: 29}, _epochStart, _epochEnd);
var res = utils.andNotOperator(t, t2);
console.log(res);
\ No newline at end of file
//gibt zu betrachtenden Zeitraum an.
var _epochStart = new Date(2014, 5, 24, 0);
var _epochEnd = new Date(_epochStart.getTime() + 100 * 24 * 3600000);
console.log("epochStart", _epochStart);
console.log("epochEnd ", _epochEnd);
function _cyclicInterval(from, until, interval, epochStart, epochEnd) { function _cyclicInterval(from, until, interval, epochStart, epochEnd) {
if(from >= until) throw new Error("startDate cant be greater than endDate"); if(from >= until) throw new Error("startDate cant be greater than endDate");
var resultArray = []; var resultArray = [];
...@@ -234,21 +227,10 @@ function andNotOperator(interval1, interval2) { ...@@ -234,21 +227,10 @@ function andNotOperator(interval1, interval2) {
return andOperator(interval1, interval2); return andOperator(interval1, interval2);
} }
//test module.exports.standard = standard;
//var a = _cyclicInterval(new Date(2014, 5, 23, 9), new Date(2014, 5, 23, 14), 7 * 24 * 3600 * 1000); module.exports.standardFromTillDay = standardFromTillDay;
//var b = _cyclicInterval(new Date(2014, 5, 23, 10), new Date(2014, 5, 23, 18), 7 * 24 * 3600 * 1000); module.exports.cyclic = cyclic;
//var c = [[new Date(2014, 5, 23, 13), new Date(2014, 6, 6, 10)]]; module.exports.cyclicFromTillDay = cyclicFromTillDay;
//var x = andNotOperator(a, b); module.exports.orOperator = orOperator;
//var y = andNotOperator(a, c); module.exports.andOperator = andOperator;
//console.log(y); module.exports.andNotOperator = andNotOperator;
//var workday = standardFromTillDay(1, 6, {h: 9, m: 0}, {h: 11, m: 45}, _epochStart, _epochEnd, 14);
//console.log(workday);
var t = cyclicFromTillDay(1, 5, -1, {h: 9, m: 0}, {h: 18, m: 29}, _epochStart, _epochEnd);
var t2 = cyclicFromTillDay(2, 2, -1, {h: 9, m: 0}, {h: 18, m: 29}, _epochStart, _epochEnd);
var res = andNotOperator(t, t2);
console.log(res);
\ 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