Commit 74ec9bc5 authored by Johannes Bill's avatar Johannes Bill

fix on repeatable hours

parent a62d2385
......@@ -139,7 +139,8 @@ function cyclicFromTillDay(daySpan, noInMonth, timeSpan, dateSpan, epochSpan) {
function _getNextNoInMonthOccurence(day, startDate, noInMonth) {
startDate = new Date(startDate);
console.log('-----');
console.log(startDate);
var _noInMonth;
if (noInMonth == -1) {
_noInMonth = 1;
......@@ -152,16 +153,19 @@ function _getNextNoInMonthOccurence(day, startDate, noInMonth) {
var dayDiff = day - startDate.getDay();
if (dayDiff < 0) dayDiff += 7;
startDate.setDate(startDate.getDate() + dayDiff);
console.log(startDate);
var currentNoInMonth = Math.ceil(startDate.getDate() / 7);
while (currentNoInMonth != _noInMonth) {
startDate = new Date(startDate.getTime() + 7 * 24 * 3600000);
startDate.setDate(startDate.getDate() + 7);
//startDate = new Date(startDate.getTime() + 7 * 24 * 3600000);
currentNoInMonth = Math.ceil(startDate.getDate() / 7);
}
if (noInMonth == -1) {
startDate.setDate(startDate.getDate() - 7);
}
console.log(startDate);
return startDate;
}
......
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