@forcecalendar/core 2.1.36 → 2.1.38
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/DateUtils.js +3 -10
- package/core/events/Event.js +3 -3
- package/package.json +1 -1
|
@@ -509,19 +509,12 @@ export class DateUtils {
|
|
|
509
509
|
*/
|
|
510
510
|
static addHoursWithDST(date, hours, timeZone) {
|
|
511
511
|
const result = new Date(date);
|
|
512
|
-
const originalOffset = DateUtils.getTimezoneOffset(date, timeZone);
|
|
513
512
|
|
|
514
|
-
//
|
|
513
|
+
// UTC millisecond arithmetic is inherently DST-agnostic.
|
|
514
|
+
// Adding hours in UTC millis always produces the correct absolute time
|
|
515
|
+
// regardless of DST transitions — no additional adjustment needed.
|
|
515
516
|
result.setTime(result.getTime() + hours * 60 * 60 * 1000);
|
|
516
517
|
|
|
517
|
-
// Check if DST transition occurred
|
|
518
|
-
const newOffset = DateUtils.getTimezoneOffset(result, timeZone);
|
|
519
|
-
if (originalOffset !== newOffset) {
|
|
520
|
-
// Adjust for DST change
|
|
521
|
-
const dstAdjustment = (newOffset - originalOffset) * 60000;
|
|
522
|
-
result.setTime(result.getTime() + dstAdjustment);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
518
|
return result;
|
|
526
519
|
}
|
|
527
520
|
|
package/core/events/Event.js
CHANGED
|
@@ -148,8 +148,8 @@ export class Event {
|
|
|
148
148
|
if (!attendee.email || !attendee.name) {
|
|
149
149
|
throw new Error(`Attendee at index ${index} must have email and name`);
|
|
150
150
|
}
|
|
151
|
-
// Validate email format
|
|
152
|
-
const emailRegex = /^[^\s@]+@[^\s
|
|
151
|
+
// Validate email format (linear-time regex, no backtracking)
|
|
152
|
+
const emailRegex = /^[^\s@]+@[^\s@.]+\.[^\s@]+$/;
|
|
153
153
|
if (!emailRegex.test(attendee.email)) {
|
|
154
154
|
throw new Error(`Invalid email for attendee: ${attendee.email}`);
|
|
155
155
|
}
|
|
@@ -919,7 +919,7 @@ export class Event {
|
|
|
919
919
|
* @returns {boolean} True if email is valid
|
|
920
920
|
*/
|
|
921
921
|
_isValidEmail(email) {
|
|
922
|
-
const emailRegex = /^[^\s@]+@[^\s
|
|
922
|
+
const emailRegex = /^[^\s@]+@[^\s@.]+\.[^\s@]+$/;
|
|
923
923
|
return emailRegex.test(email);
|
|
924
924
|
}
|
|
925
925
|
|