Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions core/calendar/DateUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,21 +507,14 @@
* @param {string} timeZone - IANA timezone string
* @returns {Date}
*/
static addHoursWithDST(date, hours, timeZone) {

Check warning on line 510 in core/calendar/DateUtils.js

View workflow job for this annotation

GitHub Actions / ESLint

'timeZone' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 510 in core/calendar/DateUtils.js

View workflow job for this annotation

GitHub Actions / Code Complexity

'timeZone' is defined but never used. Allowed unused args must match /^_/u
const result = new Date(date);
const originalOffset = DateUtils.getTimezoneOffset(date, timeZone);

// Add hours
// UTC millisecond arithmetic is inherently DST-agnostic.
// Adding hours in UTC millis always produces the correct absolute time
// regardless of DST transitions — no additional adjustment needed.
result.setTime(result.getTime() + hours * 60 * 60 * 1000);

// Check if DST transition occurred
const newOffset = DateUtils.getTimezoneOffset(result, timeZone);
if (originalOffset !== newOffset) {
// Adjust for DST change
const dstAdjustment = (newOffset - originalOffset) * 60000;
result.setTime(result.getTime() + dstAdjustment);
}

return result;
}

Expand All @@ -542,7 +535,7 @@
const timeStr = `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}:${String(second).padStart(2, '0')}`;

// Use Intl API to get the UTC time for this local time in the timezone
const formatter = new Intl.DateTimeFormat('en-US', {

Check warning on line 538 in core/calendar/DateUtils.js

View workflow job for this annotation

GitHub Actions / ESLint

'formatter' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 538 in core/calendar/DateUtils.js

View workflow job for this annotation

GitHub Actions / Code Complexity

'formatter' is assigned a value but never used. Allowed unused vars must match /^_/u
timeZone,
year: 'numeric',
month: '2-digit',
Expand Down
Loading