diff --git a/www/calendar/export.js b/www/calendar/export.js index b62de0664..694179a9f 100644 --- a/www/calendar/export.js +++ b/www/calendar/export.js @@ -396,7 +396,11 @@ define([ res[uid] = obj; }); - cb(null, res); + // setTimeout to make sure we call back after the "recurrence-id" setTimeout + // are called + setTimeout(function () { + cb(null, res); + }); }); }; diff --git a/www/calendar/recurrence.js b/www/calendar/recurrence.js index a70f9b795..9482481f6 100644 --- a/www/calendar/recurrence.js +++ b/www/calendar/recurrence.js @@ -102,17 +102,17 @@ define([ return date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate(); }; var FREQ = {}; - FREQ['daily'] = function (s) { - s.setDate(s.getDate()+1); + FREQ['daily'] = function (s, i) { + s.setDate(s.getDate()+i); }; - FREQ['weekly'] = function (s) { - s.setDate(s.getDate()+7); + FREQ['weekly'] = function (s,i) { + s.setDate(s.getDate()+(i*7)); }; - FREQ['monthly'] = function (s) { - s.setMonth(s.getMonth()+1); + FREQ['monthly'] = function (s,i) { + s.setMonth(s.getMonth()+i); }; - FREQ['yearly'] = function (s) { - s.setFullYear(s.getFullYear()+1); + FREQ['yearly'] = function (s,i) { + s.setFullYear(s.getFullYear()+i); }; // EXPAND is used to create iterations added from a BYxxx rule @@ -434,17 +434,36 @@ define([ // Manage interval for the next iteration var it = Util.once(function () { - for (var i=0; i