kelektiv / node-cron

Cron for NodeJS.
MIT License
8.48k stars 626 forks source link

"0 1 30 3 *" causes process to hang #919

Open AndreMaz opened 1 day ago

AndreMaz commented 1 day ago

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