@forcecalendar/core 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/calendar/Calendar.js +7 -9
- package/core/calendar/DateUtils.js +10 -9
- package/core/conflicts/ConflictDetector.js +24 -24
- package/core/events/Event.js +14 -20
- package/core/events/EventStore.js +70 -19
- package/core/events/RRuleParser.js +423 -394
- package/core/events/RecurrenceEngine.js +33 -21
- package/core/events/RecurrenceEngineV2.js +536 -562
- package/core/ics/ICSHandler.js +348 -348
- package/core/ics/ICSParser.js +433 -435
- package/core/index.js +1 -1
- package/core/integration/EnhancedCalendar.js +363 -398
- package/core/performance/AdaptiveMemoryManager.js +310 -308
- package/core/performance/LRUCache.js +3 -4
- package/core/performance/PerformanceOptimizer.js +4 -6
- package/core/search/EventSearch.js +409 -417
- package/core/search/SearchWorkerManager.js +338 -338
- package/core/state/StateManager.js +4 -2
- package/core/timezone/TimezoneDatabase.js +574 -271
- package/core/timezone/TimezoneManager.js +422 -402
- package/core/types.js +1 -1
- package/package.json +1 -1
|
@@ -138,11 +138,11 @@ export class RecurrenceEngine {
|
|
|
138
138
|
if (iterations >= maxIterations) {
|
|
139
139
|
console.warn('RecurrenceEngine: Invalid byDay rule, falling back to weekly interval');
|
|
140
140
|
// Reset to original and add weekly interval
|
|
141
|
-
next.setDate(originalDate +
|
|
141
|
+
next.setDate(originalDate + 7 * rule.interval);
|
|
142
142
|
}
|
|
143
143
|
} else {
|
|
144
144
|
// Simple weekly recurrence
|
|
145
|
-
next.setDate(next.getDate() +
|
|
145
|
+
next.setDate(next.getDate() + 7 * rule.interval);
|
|
146
146
|
}
|
|
147
147
|
break;
|
|
148
148
|
|
|
@@ -173,7 +173,7 @@ export class RecurrenceEngine {
|
|
|
173
173
|
|
|
174
174
|
default:
|
|
175
175
|
// Unsupported frequency
|
|
176
|
-
next.setTime(next.getTime() +
|
|
176
|
+
next.setTime(next.getTime() + 24 * 60 * 60 * 1000); // Daily fallback
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
return next;
|
|
@@ -187,8 +187,13 @@ export class RecurrenceEngine {
|
|
|
187
187
|
*/
|
|
188
188
|
static matchesByDay(date, byDay) {
|
|
189
189
|
const dayMap = {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
SU: 0,
|
|
191
|
+
MO: 1,
|
|
192
|
+
TU: 2,
|
|
193
|
+
WE: 3,
|
|
194
|
+
TH: 4,
|
|
195
|
+
FR: 5,
|
|
196
|
+
SA: 6
|
|
192
197
|
};
|
|
193
198
|
|
|
194
199
|
const dayOfWeek = date.getDay();
|
|
@@ -211,8 +216,13 @@ export class RecurrenceEngine {
|
|
|
211
216
|
*/
|
|
212
217
|
static setToWeekdayOfMonth(date, weekday, position = 1) {
|
|
213
218
|
const dayMap = {
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
SU: 0,
|
|
220
|
+
MO: 1,
|
|
221
|
+
TU: 2,
|
|
222
|
+
WE: 3,
|
|
223
|
+
TH: 4,
|
|
224
|
+
FR: 5,
|
|
225
|
+
SA: 6
|
|
216
226
|
};
|
|
217
227
|
|
|
218
228
|
// Extract weekday code if it has a number prefix
|
|
@@ -229,7 +239,7 @@ export class RecurrenceEngine {
|
|
|
229
239
|
|
|
230
240
|
// Move to the nth occurrence
|
|
231
241
|
if (position > 1) {
|
|
232
|
-
date.setDate(date.getDate() +
|
|
242
|
+
date.setDate(date.getDate() + 7 * (position - 1));
|
|
233
243
|
} else if (position === -1) {
|
|
234
244
|
// Last occurrence of the month
|
|
235
245
|
const nextMonth = new Date(date);
|
|
@@ -267,11 +277,10 @@ export class RecurrenceEngine {
|
|
|
267
277
|
return Math.abs(exceptionDate.getTime() - dateTime) < 1000; // Within 1 second
|
|
268
278
|
}
|
|
269
279
|
return exceptionDate.toDateString() === dateStr;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
280
|
+
}
|
|
281
|
+
// Simple date exception
|
|
282
|
+
const exceptionDate = exDate instanceof Date ? exDate : new Date(exDate);
|
|
283
|
+
return exceptionDate.toDateString() === dateStr;
|
|
275
284
|
});
|
|
276
285
|
}
|
|
277
286
|
|
|
@@ -327,9 +336,8 @@ export class RecurrenceEngine {
|
|
|
327
336
|
|
|
328
337
|
if (dateStr.endsWith('Z')) {
|
|
329
338
|
return new Date(Date.UTC(year, month, day, hour, minute, second));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
339
|
+
}
|
|
340
|
+
return new Date(year, month, day, hour, minute, second);
|
|
333
341
|
}
|
|
334
342
|
|
|
335
343
|
// Fallback to standard date parsing
|
|
@@ -387,9 +395,13 @@ export class RecurrenceEngine {
|
|
|
387
395
|
*/
|
|
388
396
|
static getDayName(dayCode) {
|
|
389
397
|
const dayNames = {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
398
|
+
SU: 'Sunday',
|
|
399
|
+
MO: 'Monday',
|
|
400
|
+
TU: 'Tuesday',
|
|
401
|
+
WE: 'Wednesday',
|
|
402
|
+
TH: 'Thursday',
|
|
403
|
+
FR: 'Friday',
|
|
404
|
+
SA: 'Saturday'
|
|
393
405
|
};
|
|
394
406
|
|
|
395
407
|
// Extract day code if it has a number prefix
|
|
@@ -401,10 +413,10 @@ export class RecurrenceEngine {
|
|
|
401
413
|
|
|
402
414
|
if (position) {
|
|
403
415
|
const ordinals = ['', '1st', '2nd', '3rd', '4th', '5th'];
|
|
404
|
-
const ordinal = position === -1 ? 'Last' :
|
|
416
|
+
const ordinal = position === -1 ? 'Last' : ordinals[position] || `${position}th`;
|
|
405
417
|
name = `${ordinal} ${name}`;
|
|
406
418
|
}
|
|
407
419
|
|
|
408
420
|
return name;
|
|
409
421
|
}
|
|
410
|
-
}
|
|
422
|
+
}
|