@forcecalendar/core 2.1.36 → 2.1.37
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/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
|
|