@forcecalendar/core 2.1.46 → 2.1.48

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.
@@ -473,14 +473,32 @@ export class Event {
473
473
  * @throws {Error} If otherEvent is not an Event instance or doesn't have start/end
474
474
  */
475
475
  overlaps(otherEvent) {
476
- if (otherEvent instanceof Event) {
477
- // Events don't overlap if one ends before the other starts
478
- return !(this.end <= otherEvent.start || this.start >= otherEvent.end);
479
- } else if (otherEvent && otherEvent.start && otherEvent.end) {
480
- // Allow checking against time ranges
481
- return !(this.end <= otherEvent.start || this.start >= otherEvent.end);
476
+ if (!otherEvent || (!otherEvent.start && !(otherEvent instanceof Event))) {
477
+ throw new Error('Parameter must be an Event instance or have start/end properties');
482
478
  }
483
- throw new Error('Parameter must be an Event instance or have start/end properties');
479
+
480
+ let thisStart = this.start;
481
+ let thisEnd = this.end;
482
+ let otherStart = otherEvent.start;
483
+ let otherEnd = otherEvent.end;
484
+
485
+ // Normalize all-day event boundaries for consistent comparison.
486
+ // All-day events use end=23:59:59.999, but a timed event ending at
487
+ // exactly midnight (00:00:00) of the next day should overlap with
488
+ // an all-day event on the previous day.
489
+ if (this.allDay) {
490
+ thisEnd = new Date(thisEnd);
491
+ thisEnd.setDate(thisEnd.getDate() + 1);
492
+ thisEnd.setHours(0, 0, 0, 0);
493
+ }
494
+ if (otherEvent.allDay) {
495
+ otherEnd = new Date(otherEnd);
496
+ otherEnd.setDate(otherEnd.getDate() + 1);
497
+ otherEnd.setHours(0, 0, 0, 0);
498
+ }
499
+
500
+ // Standard interval overlap: NOT (one ends before or when the other starts)
501
+ return !(thisEnd <= otherStart || thisStart >= otherEnd);
484
502
  }
485
503
 
486
504
  /**
@@ -605,6 +623,11 @@ export class Event {
605
623
  throw new Error('Attendee must have an email');
606
624
  }
607
625
 
626
+ // Validate email format (matches constructor validation)
627
+ if (!this._isValidEmail(attendee.email)) {
628
+ throw new Error(`Invalid email for attendee: ${attendee.email}`);
629
+ }
630
+
608
631
  // Check if attendee already exists
609
632
  if (this.hasAttendee(attendee.email)) {
610
633
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/core",
3
- "version": "2.1.46",
3
+ "version": "2.1.48",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "A modern, lightweight, framework-agnostic calendar engine optimized for Salesforce",