Bug Description
DateUtils.isDST() at lines 493-501 returns true when the current offset equals the MAXIMUM of January/July offsets. In the Northern Hemisphere, the maximum offset is the standard (winter) offset, not DST. This means the function returns true during standard time and false during DST — exactly backwards.
Impact
- All DST-aware date arithmetic that depends on this function produces wrong results
addHoursWithDST() (which calls this indirectly via offset comparison) may double-adjust
- Timezone conversions near DST boundaries produce incorrect times
- Affects both Northern and Southern hemisphere timezones (inverted for both)
Code Location
// DateUtils.js:493-501
static isDST(date, timeZone) {
const jan = new Date(date.getFullYear(), 0, 1);
const jul = new Date(date.getFullYear(), 6, 1);
const janOffset = DateUtils.getTimezoneOffset(jan, timeZone);
const julOffset = DateUtils.getTimezoneOffset(jul, timeZone);
const currentOffset = DateUtils.getTimezoneOffset(date, timeZone);
return Math.max(janOffset, julOffset) === currentOffset; // INVERTED
}
Fix
DST offset is the MINIMUM (least positive / most negative), not maximum:
return Math.min(janOffset, julOffset) === currentOffset;
Or equivalently, DST is when the offset differs from the standard (max) offset:
return Math.max(janOffset, julOffset) \!== currentOffset;
Files
core/calendar/DateUtils.js:493-501
Bug Description
DateUtils.isDST()at lines 493-501 returnstruewhen the current offset equals the MAXIMUM of January/July offsets. In the Northern Hemisphere, the maximum offset is the standard (winter) offset, not DST. This means the function returnstrueduring standard time andfalseduring DST — exactly backwards.Impact
addHoursWithDST()(which calls this indirectly via offset comparison) may double-adjustCode Location
Fix
DST offset is the MINIMUM (least positive / most negative), not maximum:
Or equivalently, DST is when the offset differs from the standard (max) offset:
Files
core/calendar/DateUtils.js:493-501