Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug Report: Incorrect Execution of 0 0 1 */3 * Schedule #435

@borriglione

Description

@borriglione

Bug Report: Incorrect Execution of 0 0 1 */3 * Schedule

Description

When using the node-cron module with the schedule 0 0 1 */3 *, the expected behavior is to execute the task at midnight on the 1st day of January, April, July, and October (i.e., the first day of each quarter). However, the task is also incorrectly executed on December 1st, which does not align with the intended behavior following the GNU crontab syntax: https://www.gnu.org/software/mcron/manual/html_node/Crontab-file.html

Steps to Reproduce

  1. Install node-cron in a Node.js project:
    npm install node-cron
  2. Create a script with the following schedule:
    const cron = require('node-cron');
    
    cron.schedule('0 0 1 */3 *', () => {
        console.log('Cron job executed:', new Date());
    });
  3. Run the script and observe the task execution on December 1st.

Expected Behavior

The task should only execute on:

  • January 1st
  • April 1st
  • July 1st
  • October 1st

Actual Behavior

The task incorrectly executes on December 1st, in addition to the expected dates.

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