Skip to content

bug(core): calendar schedules carry DST gap adjustments into later occurrences #5353

Closed

Description

@seekskyworld

What happened

Daily and weekly calendar schedules can carry a DST gap's adjusted hour into an occurrence on a different date. A task anchored at 02:30 can consequently run at 03:30 on an ordinary day (or 02:45 instead of 02:15 for a 30-minute transition).

nextCalendarFireAt() sets the anchor's clock time on the after date first, then changes the date with setDate(). If the first date has no such wall time, JavaScript normalizes it forward and the subsequent date change preserves the normalized hour.

How to reproduce

Run from source with TZ=America/New_York after building Core:

import { computeNextFireAt } from './packages/core/dist/scheduled-task.js';
const anchorAt = Date.parse('2026-03-01T02:30:00-05:00');
const after = Date.parse('2026-03-08T04:00:00-04:00');
for (const recurrence of ['daily', 'weekly']) {
  console.log(new Date(computeNextFireAt({ kind: 'calendar', recurrence, anchorAt }, after)).toString());
}

Actual: March 9 and March 15 at 03:30. Expected: those dates at 02:30, using the original anchor's local clock time.

A Tuesday weekly anchor also produces Tuesday 03:30 when evaluated on the spring-transition Sunday, even though the target Tuesday has no gap.

Environment

  • Source commit: e13656ef355dff5abc6862eab7f6ff32108a5ffe
  • OS: macOS arm64
  • Surface: shared Core scheduling (Runtime Host / Desktop scheduled tasks)
  • Node.js: v26.4.0
  • Reproduced with process-local TZ=America/New_York and TZ=Australia/Lord_Howe.

Logs, screenshots, or additional context

The fix can reconstruct each candidate from its intended calendar date and the original anchor's clock fields. This preserves the existing normalization of an occurrence that actually falls in a gap and the existing fall-back fold policy. No schedule schema change is needed.

Automated report by OpenAI Codex on behalf of the contributor; a regression test fails on the current source and a local fix is being validated.

Activity

  1. seekskyworld commented on Sep 15, 2026

    @seekskyworld
    ContributorAuthor

    take

  2. added
    bug
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions