updated calendar to weekly recurring items
This commit is contained in:
parent
2de941d389
commit
ec604e2b39
@ -41,9 +41,11 @@ function processICAL(ical) {
|
||||
var _workBlock = workBlock;
|
||||
// logger.debug('Processing recurrence...');
|
||||
// logger.debug('Processing recurrence...');
|
||||
var weekBits = {'SU':0,'MO':1,'TU':2,'WE':3,'TH':4,'FR':5,'SA':6};
|
||||
var blocks=[];
|
||||
var now = new Date();
|
||||
var day = now.getDate();
|
||||
var dayNum = now.getDay();
|
||||
var month = now.getMonth();
|
||||
var year = now.getFullYear();
|
||||
|
||||
@ -118,6 +120,18 @@ function processICAL(ical) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (recurSettings.freq === 'WEEKLY' && recurSettings.interval === null) {
|
||||
var byDayBit = recurSettings.byday.split(',')[0];
|
||||
var byDayNumber = weekBits[byDayBit];
|
||||
if (byDayNumber >= dayNum) {
|
||||
var daysAdded = byDayNumber - dayNum;
|
||||
newStart = Date.create().set({year:year, month: month , day: day, hour:_h, minutes:_min, seconds:_secs}).addDays(daysAdded);
|
||||
newEnd = Date.create(newStart).addMilliseconds(distance);
|
||||
_workBlock.dtstart = newStart;
|
||||
_workBlock.dtend = newEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we get here we've skipped everything just return the _workblock
|
||||
@ -143,6 +157,7 @@ function processICAL(ical) {
|
||||
blockStep = block[step];
|
||||
if (blockStep.indexOf(segments.recur) >= 0) {
|
||||
workBlock.recur = STRING(block[step].split(segments.recur)[1]).collapseWhitespace().s;
|
||||
//logger.debug(workBlock.recur);
|
||||
}
|
||||
|
||||
if (blockStep.indexOf(segments.summaryID) >= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user