Skip to content

Cron: make handling of repeated DST hours configurable #9902

Closed

Description

@eugene1g

What is the problem this feature would solve?

Five-minute polling schedules in a local timezone can pause for over an hour when clocks go back. #8800 confirms that using only the first occurrence of a repeated local time is intentional, but there is no option to keep polling through both occurrences.

For example, with Effect 4.0.6:

import { Cron } from "effect";

const cron = Cron.parseUnsafe("*/5 * * * *", "Europe/Berlin");

console.log(
  Cron.next(cron, new Date("2026-10-25T00:55:00Z")).toISOString()
);
// 2026-10-25T02:00:00.000Z

This creates a 65-minute gap, skipping 12 five-minute runs during the repeated hour. We confirmed the same behavior with Effect.schedule and Effect.repeat using TestClock.

What is the feature you are proposing to solve the problem?

Let callers choose whether repeated local times run on the first occurrence, the second, or both, while keeping the current default. The option should work consistently across the Cron APIs and Schedule.cron.

#6490 explored configurable DST handling but was closed without merging. Could we revisit that approach?

What alternatives have you considered?

UTC cron schedules and interval schedules work well for simple polling. However, UTC schedules shift relative to local time across DST, and intervals do not express local calendar schedules. A configurable policy would let applications keep those schedules while choosing how to handle the repeated hour.

Activity

  1. changed the title [-]Allow configurable handling of repeated DST hours in `Cron` and `Schedule.cron`[/-] [+]Cron: make handling of repeated DST hours configurable[/+] on Oct 25, 2026
  2. harshitsharmaaaa commented on Oct 25, 2026

    @harshitsharmaaaa

    Hey, I'd like to work on this if nobody has picked it up yet. I can look into adding an option to handle the repeated DST hour (first occurrence, second occurrence, or both), while keeping the current behavior as the default. I'll also add tests around the DST transition using TestClock and check that the behavior stays consistent across Cron and Schedule.cron. Would this approach be okay with the maintainers?

  3. fubhy commented on Oct 25, 2026

    @fubhy
    Member
  4. effect-bot commented on Oct 25, 2026

    @effect-bot
    Contributor

    Thanks @fubhy — this is tracked internally as EFF-2905 and I've added your request to fix it there. A PR will be linked back to this issue once it's ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions