@forcecalendar/core 2.1.22 → 2.1.24

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.
@@ -256,8 +256,11 @@ export class DateUtils {
256
256
  * @returns {number}
257
257
  */
258
258
  static differenceInDays(date1, date2) {
259
- const diff = date1.getTime() - date2.getTime();
260
- return Math.floor(diff / (1000 * 60 * 60 * 24));
259
+ // Normalize to midnight to avoid DST-related hour differences
260
+ const d1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
261
+ const d2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
262
+ const diff = d1.getTime() - d2.getTime();
263
+ return Math.round(diff / (1000 * 60 * 60 * 24));
261
264
  }
262
265
 
263
266
  /**
@@ -639,6 +639,8 @@ export class EventStore {
639
639
  this.indices.byDate.clear();
640
640
  this.indices.byMonth.clear();
641
641
  this.indices.recurring.clear();
642
+ this.indices.byCategory.clear();
643
+ this.indices.byStatus.clear();
642
644
 
643
645
  this._notifyChange({
644
646
  type: 'clear',
@@ -10,7 +10,10 @@ export class ICSParser {
10
10
  static MAX_LINES = 100000; // 100k lines
11
11
  static MAX_EVENTS = 10000; // 10k events
12
12
 
13
- constructor() {
13
+ constructor(options = {}) {
14
+ // Configurable max file size (defaults to static limit)
15
+ this.maxFileSize = options.maxFileSize || ICSParser.MAX_INPUT_SIZE;
16
+
14
17
  // ICS line folding max width
15
18
  this.maxLineLength = 75;
16
19
 
@@ -38,10 +41,13 @@ export class ICSParser {
38
41
  * @returns {Array} Array of event objects
39
42
  */
40
43
  parse(icsString) {
41
- // Enforce input size limit
42
- if (typeof icsString === 'string' && icsString.length > ICSParser.MAX_INPUT_SIZE) {
44
+ if (typeof icsString !== 'string') {
45
+ throw new Error('ICS input must be a string');
46
+ }
47
+ // Enforce input size limit (uses instance config, falling back to static default)
48
+ if (icsString.length > this.maxFileSize) {
43
49
  throw new Error(
44
- `ICS input exceeds maximum size of ${ICSParser.MAX_INPUT_SIZE / (1024 * 1024)}MB`
50
+ `ICS input exceeds maximum size of ${this.maxFileSize / (1024 * 1024)}MB`
45
51
  );
46
52
  }
47
53
 
@@ -306,6 +312,13 @@ export class ICSParser {
306
312
  event.recurrenceRule = value;
307
313
  event.recurring = true;
308
314
  break;
315
+
316
+ case 'EXDATE': {
317
+ if (!event.excludeDates) event.excludeDates = [];
318
+ const dates = value.split(',').map(d => this.parseDate(d.trim(), property));
319
+ event.excludeDates.push(...dates.filter(d => d !== null));
320
+ break;
321
+ }
309
322
  }
310
323
  }
311
324
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/core",
3
- "version": "2.1.22",
3
+ "version": "2.1.24",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "A modern, lightweight, framework-agnostic calendar engine optimized for Salesforce",