Skip to content

"0 1 30 3 *" creates infinite loop #919

@AndreMaz

Description

@AndreMaz

Description

The following snippet blocks the process

import { CronJob } from "cron";
const job2 = new CronJob(
  "0 1 30 3 *",
  function () {
    console.log("You will see this message every second");
  }, // onTick
  null, // onComplete
  false, // start
  "Europe/Lisbon" // timeZone
);

console.log(job2.nextDates(1));

Expression at crontab.guru
image

What causes the issue is the fact that in Portugal the daylight savings starts at Mar 30 so the 01:00 does not actually exist.

Expected Behavior

Next execution date to be returned or an error/ warning to be shown

Actual Behavior

The process hangs forever

Possible Fix

Steps to Reproduce

Context

Your Environment

  • cron version: 3.2.1
  • NodeJS version: v20.14.0
  • Operating System and version: Ubuntu LTS 24.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions