@forcecalendar/core 1.0.5 → 1.0.7

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.
@@ -736,8 +736,8 @@ export class Calendar {
736
736
  // Clear all listeners
737
737
  this.listeners.clear();
738
738
 
739
- // Clear stores
740
- this.eventStore.clear();
739
+ // Properly destroy EventStore (clears events, caches, and cleanup timers)
740
+ this.eventStore.destroy();
741
741
 
742
742
  // Clear plugins
743
743
  this.plugins.forEach(plugin => {
@@ -747,6 +747,9 @@ export class Calendar {
747
747
  });
748
748
  this.plugins.clear();
749
749
 
750
+ // Clear view instances
751
+ this.views.clear();
752
+
750
753
  this._emit('destroy');
751
754
  }
752
755
  }// Test workflow
@@ -37,8 +37,9 @@ export class DateUtils {
37
37
  const day = result.getDay();
38
38
  const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
39
39
 
40
- // Use setTime to handle month/year boundaries correctly
41
- result.setTime(result.getTime() - (diff * 24 * 60 * 60 * 1000));
40
+ // Use setDate() to handle DST transitions correctly
41
+ // (millisecond arithmetic fails when days are 23 or 25 hours)
42
+ result.setDate(result.getDate() - diff);
42
43
  result.setHours(0, 0, 0, 0);
43
44
  return result;
44
45
  }
@@ -51,8 +52,9 @@ export class DateUtils {
51
52
  */
52
53
  static endOfWeek(date, weekStartsOn = 0) {
53
54
  const result = DateUtils.startOfWeek(date, weekStartsOn);
54
- // Use setTime to handle month/year boundaries correctly
55
- result.setTime(result.getTime() + (6 * 24 * 60 * 60 * 1000));
55
+ // Use setDate() to handle DST transitions correctly
56
+ // (millisecond arithmetic fails when days are 23 or 25 hours)
57
+ result.setDate(result.getDate() + 6);
56
58
  result.setHours(23, 59, 59, 999);
57
59
  return result;
58
60
  }
@@ -101,8 +103,9 @@ export class DateUtils {
101
103
  */
102
104
  static addDays(date, days) {
103
105
  const result = new Date(date);
104
- // Use setTime to handle month/year boundaries correctly
105
- result.setTime(result.getTime() + (days * 24 * 60 * 60 * 1000));
106
+ // Use setDate() to handle DST transitions correctly
107
+ // (millisecond arithmetic fails when days are 23 or 25 hours)
108
+ result.setDate(result.getDate() + days);
106
109
  return result;
107
110
  }
108
111
 
@@ -402,8 +405,9 @@ export class DateUtils {
402
405
 
403
406
  while (current.getTime() <= endTime) {
404
407
  dates.push(new Date(current));
405
- // Use setTime to handle month/year boundaries correctly
406
- current.setTime(current.getTime() + (24 * 60 * 60 * 1000));
408
+ // Use setDate() to handle DST transitions correctly
409
+ // (millisecond arithmetic fails when days are 23 or 25 hours)
410
+ current.setDate(current.getDate() + 1);
407
411
  }
408
412
 
409
413
  return dates;
@@ -367,7 +367,8 @@ export class EventStore {
367
367
  // Collect all events from those dates
368
368
  const checkedIds = new Set();
369
369
  dates.forEach(date => {
370
- const dateStr = date.toDateString();
370
+ // Use getLocalDateString to match the index key format (YYYY-MM-DD)
371
+ const dateStr = DateUtils.getLocalDateString(date);
371
372
  const eventIds = this.indices.byDate.get(dateStr) || new Set();
372
373
 
373
374
  eventIds.forEach(id => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/core",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "A modern, lightweight, framework-agnostic calendar engine optimized for Salesforce",