@forcecalendar/core 2.1.42 → 2.1.44
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/ics/ICSHandler.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { ICSParser } from './ICSParser.js';
|
|
7
7
|
import { Event } from '../events/Event.js';
|
|
8
|
+
import { RecurrenceEngineV2 } from '../events/RecurrenceEngineV2.js';
|
|
8
9
|
|
|
9
10
|
export class ICSHandler {
|
|
10
11
|
constructor(calendar) {
|
|
@@ -380,6 +381,7 @@ export class ICSHandler {
|
|
|
380
381
|
const expanded = [];
|
|
381
382
|
const rangeStart = dateRange?.start || new Date();
|
|
382
383
|
const rangeEnd = dateRange?.end || new Date(Date.now() + 365 * 24 * 60 * 60 * 1000);
|
|
384
|
+
const recurrenceEngine = new RecurrenceEngineV2();
|
|
383
385
|
|
|
384
386
|
for (const event of events) {
|
|
385
387
|
if (!(event.recurring || event.recurrenceRule || event.recurrence)) {
|
|
@@ -387,26 +389,20 @@ export class ICSHandler {
|
|
|
387
389
|
continue;
|
|
388
390
|
}
|
|
389
391
|
|
|
390
|
-
//
|
|
391
|
-
|
|
392
|
-
const instances = [
|
|
393
|
-
{
|
|
394
|
-
start: event.start,
|
|
395
|
-
end: event.end
|
|
396
|
-
}
|
|
397
|
-
];
|
|
392
|
+
// Use RecurrenceEngineV2 to expand occurrences within the date range
|
|
393
|
+
const occurrences = recurrenceEngine.expandEvent(event, rangeStart, rangeEnd);
|
|
398
394
|
|
|
399
|
-
// Add each
|
|
400
|
-
for (const
|
|
395
|
+
// Add each occurrence as a separate event
|
|
396
|
+
for (const occurrence of occurrences) {
|
|
401
397
|
expanded.push({
|
|
402
398
|
...event,
|
|
403
|
-
id: `${event.id}-${
|
|
404
|
-
start:
|
|
405
|
-
end:
|
|
399
|
+
id: `${event.id}-${occurrence.start.getTime()}`,
|
|
400
|
+
start: occurrence.start,
|
|
401
|
+
end: occurrence.end,
|
|
406
402
|
recurring: false,
|
|
407
403
|
recurrenceRule: null,
|
|
408
|
-
recurrence: null,
|
|
409
|
-
parentId: event.id
|
|
404
|
+
recurrence: null,
|
|
405
|
+
parentId: event.id
|
|
410
406
|
});
|
|
411
407
|
}
|
|
412
408
|
}
|
|
@@ -57,7 +57,7 @@ export class EnhancedCalendar extends Calendar {
|
|
|
57
57
|
/**
|
|
58
58
|
* Get events with enhanced recurrence expansion
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
getEventsInRange(startDate, endDate, options = {}) {
|
|
61
61
|
const startTime = performance.now();
|
|
62
62
|
|
|
63
63
|
const regularEvents = [];
|