Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cron

kelektiv13.1mMIT4.3.1TypeScript support: included

Cron jobs for your node

cron, node cron, node-cron, schedule, scheduler, cronjob, cron job

readme

cron for Node.js logo
cron is a robust tool for running jobs (functions or commands) on schedules defined using the cron syntax.
Perfect for tasks like data backups, notifications, and many more!

Cron for Node.js

Version Monthly Downloads Build Status CodeQL Status Coverage Renovate OpenSSF Scorecard Discord

🌟 Features

  • execute a function whenever your scheduled job triggers
  • execute a job external to the javascript process (like a system command) using child_process
  • use a Date or Luxon DateTime object instead of cron syntax as the trigger for your callback
  • use an additional slot for seconds (leaving it off will default to 0 and match the Unix behavior)

🚀 Installation

npm install cron

Table of Contents

  1. Features
  2. Installation
  3. Migrating
  4. Basic Usage
  5. Cron Patterns
  6. API
  7. Gotchas
  8. Community
  9. Contributing
  10. Acknowledgements
  11. License

⬆ Migrating

v4 dropped Node v16 and renamed the job.running property:

<summary>Migrating from v3 to v4</summary>

Dropped Node version

Node v16 is no longer supported. Upgrade your Node installation to Node v18 or above

Property renamed and now read-only

You can no longer set the running property (now isActive). It is read-only. To start or stop a cron job, use job.start() and job.stop().

v3 introduced TypeScript and tighter Unix cron pattern alignment:

<summary>Migrating from v2 to v3</summary>

Month & day-of-week indexing changes

  • Month Indexing: Changed from 0-11 to 1-12. So you need to increment all numeric months by 1.

  • Day-of-Week Indexing: Support added for 7 as Sunday.

Adjustments in CronJob

  • The constructor no longer accepts an object as its first and only params. Use CronJob.from(argsObject) instead.
  • Callbacks are now called in the order they were registered.
  • nextDates(count?: number) now always returns an array (empty if no argument is provided). Use nextDate() instead for a single date.

Removed methods

  • removed job() method in favor of new CronJob(...args) / CronJob.from(argsObject)

  • removed time() method in favor of new CronTime()

🛠 Basic Usage

import { CronJob } from 'cron';

const job = new CronJob(
    '* * * * * *', // cronTime
    function () {
        console.log('You will see this message every second');
    }, // onTick
    null, // onComplete
    true, // start
    'America/Los_Angeles' // timeZone
);
// job.start() is optional here because of the fourth parameter set to true.
// equivalent job using the "from" static method, providing parameters as an object
const job = CronJob.from({
    cronTime: '* * * * * *',
    onTick: function () {
        console.log('You will see this message every second');
    },
    start: true,
    timeZone: 'America/Los_Angeles'
});

Note: In the first example above, the fourth parameter to CronJob() starts the job automatically. If not provided or set to falsy, you must explicitly start the job using job.start().

For more advanced examples, check the examples directory.

⏰ Cron Patterns

Cron patterns are the backbone of this library. Familiarize yourself with the syntax:

- `*` Asterisks: Any value
- `1-3,5` Ranges: Ranges and individual values
- `*/2` Steps: Every two units

Detailed patterns and explanations are available at crontab.org. The examples in the link have five fields, and 1 minute as the finest granularity, but our cron scheduling supports an enhanced format with six fields, allowing for second-level precision. Tools like crontab.guru can help in constructing patterns but remember to account for the seconds field.

Supported Ranges

Here's a quick reference to the UNIX Cron format this library uses, plus an added second field:

field          allowed values
-----          --------------
second         0-59
minute         0-59
hour           0-23
day of month   1-31
month          1-12 (or names, see below)
day of week    0-7 (0 or 7 is Sunday, or use names)

Names can also be used for the 'month' and 'day of week' fields. Use the first three letters of the particular day or month (case does not matter). Ranges and lists of names are allowed.
Examples: "mon,wed,fri", "jan-mar".

📖 API

Standalone Functions

  • sendAt: Indicates when a CronTime will execute (returns a Luxon DateTime object).

    import * as cron from 'cron';
    
    const dt = cron.sendAt('0 0 * * *');
    console.log(`The job would run at: ${dt.toISO()}`);
  • timeout: Indicates the number of milliseconds in the future at which a CronTime will execute (returns a number).

    import * as cron from 'cron';
    
    const timeout = cron.timeout('0 0 * * *');
    console.log(`The job would run in ${timeout}ms`);
  • validateCronExpression: Validates if a given cron expression is valid (returns an object with valid and error properties).

    import * as cron from 'cron';
    
    const validation = cron.validateCronExpression('0 0 * * *');
    console.log(`Is the cron expression valid? ${validation.valid}`);
    if (!validation.valid) {
        console.error(`Validation error: ${validation.error}`);
    }

CronJob Class

Constructor

constructor(cronTime, onTick, onComplete, start, timeZone, context, runOnInit, utcOffset, unrefTimeout, waitForCompletion, errorHandler, name, threshold):

  • cronTime: [REQUIRED] - The time to fire off your job. Can be cron syntax, a JS Date object or a Luxon DateTime object.

  • onTick: [REQUIRED] - Function to execute at the specified time. If an onComplete callback was provided, onTick will receive it as an argument.

  • onComplete: [OPTIONAL] - Invoked when the job is halted with job.stop(). It might also be triggered by onTick post its run.

  • start: [OPTIONAL] - Determines if the job should commence before constructor exit. Default is false.

  • timeZone: [OPTIONAL] - Sets the execution time zone. Default is local time. Check valid formats in the Luxon documentation.

  • context: [OPTIONAL] - Execution context for the onTick method.

  • runOnInit: [OPTIONAL] - Instantly triggers the onTick function post initialization. Default is false.

  • utcOffset: [OPTIONAL] - Specifies time zone offset in minutes. Cannot co-exist with timeZone.

  • unrefTimeout: [OPTIONAL] - Useful for controlling event loop behavior. More details here.

  • waitForCompletion: [OPTIONAL] - If true, no additional instances of the onTick callback function will run until the current onTick callback has completed. Any new scheduled executions that occur while the current callback is running will be skipped entirely. Default is false.

  • errorHandler: [OPTIONAL] - Function to handle any exceptions that occur in the onTick method.

  • name: [OPTIONAL] - Name of the job. Useful for identifying jobs in logs.

  • threshold: [OPTIONAL] - Threshold in ms to control whether to execute or skip missed execution deadlines caused by slow or busy hardware. Execution delays within threshold will be executed immediately, and otherwise will be skipped. In both cases a warning will be printed to the console with the job name and cron expression. See issue #962 for more information. Default is 250.

Methods

  • from (static): Create a new CronJob object providing arguments as an object. See argument names and descriptions above.

  • start: Initiates the job.

  • stop: Halts the job.

  • setTime: Modifies the time for the CronJob. Parameter must be a CronTime.

  • lastDate: Provides the last execution date.

  • nextDate: Indicates the subsequent date that will activate an onTick.

  • nextDates(count): Supplies an array of upcoming dates that will initiate an onTick.

  • fireOnTick: Allows modification of the onTick calling behavior.

  • addCallback: Permits addition of onTick callbacks.

Properties

  • isActive: [READ-ONLY] Indicates if a job is active (checking to see if the callback needs to be called).

  • isCallbackRunning: [READ-ONLY] Indicates if a callback is currently executing.

    const job = new CronJob('* * * * * *', async () => {
        console.log(job.isCallbackRunning); // true during callback execution
        await someAsyncTask();
        console.log(job.isCallbackRunning); // still true until callback completes
    });
    
    console.log(job.isCallbackRunning); // false
    job.start();
    console.log(job.isActive); // true
    console.log(job.isCallbackRunning); // false

CronTime Class

Constructor

constructor(time, zone, utcOffset):

  • time: [REQUIRED] - The time to initiate your job. Accepts cron syntax or a JS Date object.

  • zone: [OPTIONAL] - Equivalent to timeZone from CronJob parameters.

  • utcOffset: [OPTIONAL] - Analogous to utcOffset from CronJob parameters.

💢 Gotchas

  • Both JS Date and Luxon DateTime objects don't guarantee millisecond precision due to computation delays. This module excludes millisecond precision for standard cron syntax but allows execution date specification through JS Date or Luxon DateTime objects. However, specifying a precise future execution time, such as adding a millisecond to the current time, may not always work due to these computation delays. It's observed that delays less than 4-5 ms might lead to inconsistencies. While we could limit all date granularity to seconds, we've chosen to allow greater precision but advise users of potential issues.

  • Using arrow functions for onTick binds them to the parent's this context. As a result, they won't have access to the cronjob's this context. You can read a little more in issue #47 (comment).

🤝 Community

Join the Discord server! Here you can discuss issues and get help in a more casual forum than GitHub.

🌍 Contributing

This project is looking for help! If you're interested in helping with the project, please take a look at our contributing documentation.

🐛 Submitting Bugs/Issues

Please have a look at our contributing documentation, it contains all the information you need to know before submitting an issue.

🙏 Acknowledgements

This is a community effort project. In the truest sense, this project started as an open source project from cron.js and grew into something else. Other people have contributed code, time, and oversight to the project. At this point there are too many to name here so we'll just say thanks.

Special thanks to Hiroki Horiuchi, Lundarl Gholoi and koooge for their work on the DefinitelyTyped typings before they were imported in v2.4.0.

⚖ License

MIT

changelog

4.3.1 (2025-05-29)

🐛 Bug Fixes

♻️ Chores

  • action: update actions/setup-node action to v4.4.0 (86f8cec)
  • action: update github/codeql-action action to v3.28.16 (33d396f)
  • action: update github/codeql-action action to v3.28.17 (97a9185)
  • action: update github/codeql-action action to v3.28.18 (6a72709)
  • action: update step-security/harden-runner action to v2.12.0 (c0ad19d)
  • deps: lock file maintenance (784bc9c)
  • deps: lock file maintenance (7a97350)
  • deps: lock file maintenance (40163b4)
  • deps: lock file maintenance (9bcb7e3)
  • deps: lock file maintenance (#983) (3df1cf6)
  • deps: update dependency @eslint/js to v9.25.1 (162008f)
  • deps: update dependency @eslint/js to v9.27.0 (5c1161c)
  • deps: update dependency @semantic-release/github to v11.0.2 (d27afcd)
  • deps: update dependency @swc/core to v1.11.21 (a195b0f)
  • deps: update dependency @swc/core to v1.11.29 (edd52d4)
  • deps: update dependency @types/node to v22.14.1 (f24a7cb)
  • deps: update dependency @types/node to v22.15.15 (#984) (bfb12a7)
  • deps: update dependency @types/node to v22.15.21 (86b539a)
  • deps: update dependency lint-staged to v15.5.1 (25a3659)
  • deps: update dependency lint-staged to v15.5.2 (be017c5)
  • deps: update linters (6ed6fdb)
  • deps: update semantic-release related packages (555bba9)
  • deps: update swc monorepo (edd3284)

4.3.0 (2025-04-15)

✨ Features

4.2.1-beta.1 (2025-04-15)

🐛 Bug Fixes

  • prevent jobs from stopping unexpectedly (#963) (69d2ef5)

4.2.0 (2025-04-14)

✨ Features

♻️ Chores

  • action: update github/codeql-action action to v3.28.15 (baf9c7e)
  • action: update marocchino/sticky-pull-request-comment action to v2.9.2 (#975) (df57bef)
  • action: update step-security/harden-runner action to v2.11.1 (da1764d)
  • deps: lock file maintenance (c37a3ec)
  • deps: lock file maintenance (#979) (6a355a3)
  • deps: pin dependencies (6ddc31e)
  • deps: update dependency @fast-check/jest to v2.1.1 (3fa6836)
  • deps: update dependency @swc/core to v1.11.18 (00d0685)
  • deps: update dependency @types/node to v22.14.0 (7dedc90)
  • deps: update dependency sinon to v19.0.5 (448934c)
  • deps: update dependency sinon to v20 (#974) (ac25eff)
  • deps: update dependency typescript to v5.8.3 (7b583a4)
  • deps: update linters (#978) (cdb638a)
  • deps: update node.js to v23.11.0 (#973) (7d457cf)

4.1.4 (2025-04-06)

🛠 Builds

♻️ Chores

  • deps: lock file maintenance (c3190bf)

4.1.3 (2025-03-28)

🛠 Builds

  • deps: update dependency luxon to ~3.6.0 (5935617)

4.1.2 (2025-03-28)

🐛 Bug Fixes

4.1.1 (2025-03-26)

🐛 Bug Fixes

  • cron should still execute after changing the time back during daylight savings (#966) (8cf0712), closes #881 #881

♻️ Chores

  • action: update actions/setup-node action to v4.3.0 (e70709f)
  • action: update actions/upload-artifact action to v4.6.1 (06ed76c)
  • action: update actions/upload-artifact action to v4.6.2 (69ea222)
  • action: update github/codeql-action action to v3.28.10 (1d14a08)
  • action: update github/codeql-action action to v3.28.11 (cd28d4f)
  • action: update github/codeql-action action to v3.28.13 (154f885)
  • action: update ossf/scorecard-action action to v2.4.1 (6a4ec39)
  • deps: lock file maintenance (6742c01)
  • deps: lock file maintenance (a97cdb1)
  • deps: lock file maintenance (c585973)
  • deps: lock file maintenance (e156aa7)
  • deps: update dependency @commitlint/cli to v19.8.0 (3984884)
  • deps: update dependency @eslint/js to v9.22.0 (7415480)
  • deps: update dependency @eslint/js to v9.23.0 (00fc7ed)
  • deps: update dependency @fast-check/jest to v2.1.0 (a9a8608)
  • deps: update dependency @types/node to v22.13.11 (38cf6a6)
  • deps: update dependency @types/node to v22.13.5 (a746320)
  • deps: update dependency @types/node to v22.13.9 (4ac339f)
  • deps: update dependency lint-staged to v15.5.0 (5efb27f)
  • deps: update dependency prettier to v3.5.3 (d8f2456)
  • deps: update dependency sinon to v19.0.4 (5144f4d)
  • deps: update dependency ts-jest to v29.2.6 (3625528)
  • deps: update dependency typescript to v5.8.2 (4ef66e8)
  • deps: update linters (ecbe916)
  • deps: update node.js to v23.10.0 (#970) (6775fff)
  • deps: update tests (5d5e555)

4.1.0 (2025-02-24)

✨ Features

  • add isCronTimeValid function to validate cron expressions (#959) (cbd8106)

♻️ Chores

  • action: update actions/setup-node action to v4.2.0 (#950) (3a4a701)
  • action: update github/codeql-action action to v3.28.9 (#946) (84ebb32)
  • action: update marocchino/sticky-pull-request-comment action to v2.9.1 (#947) (7cdcbc2)
  • action: update step-security/harden-runner action to v2.11.0 (#948) (b7f9c79)
  • deps: lock file maintenance (fa08aa3)
  • deps: lock file maintenance (#944) (374ac42)
  • deps: update dependency @types/node to v22.13.4 (#952) (05f1702)
  • deps: update dependency lint-staged to v15.4.3 (#953) (b99fc3b)
  • deps: update dependency typescript to v5.7.3 (#949) (5313b71)
  • deps: update linters (#954) (9159759)
  • deps: update semantic-release related packages (#951) (92d7ac3)
  • remove bower.json, which is unused (#955) (8e509f3)

4.0.0 (2025-02-19)

⚠ Breaking changes

  • drop support for Node v16 and rename job.running to job.isActive (#957)

📦 Code Refactoring

  • drop support for Node v16 and rename job.running to job.isActive (#957) (605e94e), closes #902 #905

♻️ Chores

  • action: update actions/checkout action to v4.2.2 (#927) (ff1721e)
  • action: update actions/setup-node action to v4.1.0 (#928) (3e27773)
  • action: update actions/upload-artifact action to v4.6.0 (#931) (8283000)
  • action: update amannn/action-semantic-pull-request action to v5.5.3 (#929) (f1851d7)
  • action: update github/codeql-action action to v3.28.1 (#922) (eefd476)
  • deps: lock file maintenance (c3af5fc)
  • deps: lock file maintenance (d689a1c)
  • renovate: improve schedules & automerging to reduce noise (#942) (c253032)

3.5.0 (2025-01-10)

✨ Features

  • throw instead of silently rewriting invalid cron expressions (#937) (dcc5b93)

⚙️ Continuous Integrations

  • action: update step-security/harden-runner action to v2.10.3 (#943) (cd7ee9f)

♻️ Chores

3.4.0 (2025-01-09)

✨ Features

📚 Documentation

  • contributing: add "Submitting a Pull Request" & "Coding Rules" sections (#936) (ddd8988)

♻️ Chores

  • deps: lock file maintenance (494b4bf)
  • deps: update dependency @types/node to v20.17.11 (2978e92)
  • deps: update dependency lint-staged to v15.3.0 (11f9bad)
  • deps: update semantic-release related packages (b830bdb)
  • deps: update tests (major) (#826) (e47fd5a)

3.3.2 (2024-12-30)

🐛 Bug Fixes

⚙️ Continuous Integrations

  • action: update marocchino/sticky-pull-request-comment action to v2.9.0 (#930) (1e7bce9)
  • renovate: pin GitHub action digests to semver (#926) (6541167)

♻️ Chores

3.3.1 (2024-12-12)

🐛 Bug Fixes

3.3.0 (2024-12-10)

✨ Features

⚙️ Continuous Integrations

  • action: update github/codeql-action action to v3.27.2 (#912) (d11ba30)
  • action: update github/codeql-action action to v3.27.5 (#917) (2a4035e)
  • action: update step-security/harden-runner action to v2.10.2 (#920) (26a8f9f)
  • add pre-commit hook to lint and prettify (#911) (e1140d1), closes #907

♻️ Chores

  • deps: lock file maintenance (94465ae)
  • deps: lock file maintenance (23d67a4)
  • deps: lock file maintenance (135fdf7)
  • deps: lock file maintenance (edcff3b)
  • deps: pin dependency lint-staged to 15.2.10 (#916) (5cf24da)
  • deps: update dependency @commitlint/cli to v19.6.0 (9d9ab94)
  • deps: update dependency @types/node to v20.17.7 (9181b6a)
  • deps: update dependency @types/node to v20.17.8 (5899fc2)
  • deps: update dependency @types/node to v20.17.9 (ca5065a)
  • deps: update dependency husky to v9.1.7 (a960a29)
  • deps: update dependency typescript to v5.7.2 (3447ff5)

3.2.1 (2024-11-12)

🛠 Builds

3.2.0 (2024-11-12)

✨ Features

⚙️ Continuous Integrations

  • action: update actions/checkout action to v4.2.2 (#880) (293f54a)
  • action: update actions/checkout digest to 11bd719 (#879) (0287c69)
  • action: update actions/setup-node digest to 39370e3 (#889) (0f7a3aa)
  • action: update actions/upload-artifact action to v4.4.3 (#878) (226ad5b)
  • action: update step-security/harden-runner action to v2.10.1 (#882) (b09438e)

♻️ Chores

3.1.9 (2024-11-04)

🛠 Builds

  • typescript: add missing "types" property to package.json (#908) (1953c97)

📚 Documentation

  • Add .nvmrc with recommended Node version for development (#904) (91848e9)

⚙️ Continuous Integrations

  • action: update github/codeql-action action to v3.27.0 (#866) (a6dd871)
  • action: update ossf/scorecard-action action to v2.4.0 (#883) (e0880a1)

♻️ Chores

3.1.8 (2024-10-29)

🛠 Builds

  • deps: update dependency luxon to ~3.5.0 (676045b)

⚙️ Continuous Integrations

  • allow Renovate to auto-merge minor and patch dependency version updates (#901) (3899b5d)

♻️ Chores

  • deps: lock file maintenance (f28aed4)
  • deps: lock file maintenance (a420629)
  • deps: lock file maintenance (63a1cf1)
  • deps: lock file maintenance (7366c8f)
  • deps: lock file maintenance (c44d785)
  • deps: lock file maintenance (cf74b29)
  • deps: lock file maintenance (67b2327)
  • deps: lock file maintenance (190d845)
  • deps: lock file maintenance (166c4a2)
  • deps: lock file maintenance (b6680c7)
  • deps: lock file maintenance (18679e9)
  • deps: lock file maintenance (d99fc57)
  • deps: lock file maintenance (8c63a93)
  • deps: lock file maintenance (91a5d20)
  • deps: lock file maintenance (738f2ac)
  • deps: lock file maintenance (59df061)
  • deps: lock file maintenance (ad3aac7)
  • deps: lock file maintenance (abda61e)
  • deps: lock file maintenance (b6954f8)
  • deps: lock file maintenance (650401f)
  • deps: lock file maintenance (a9cd1a6)
  • deps: lock file maintenance (652b595)
  • deps: lock file maintenance (e52f3e7)
  • deps: lock file maintenance (a149323)
  • deps: lock file maintenance (dc19fcd)
  • deps: lock file maintenance (9aab99b)
  • deps: lock file maintenance (5a8f16d)
  • deps: lock file maintenance (e2ab57f)
  • deps: lock file maintenance (cdc4477)
  • deps: lock file maintenance (83e2a67)
  • deps: lock file maintenance (4ffc01c)
  • deps: update dependency @fast-check/jest to v1.8.2 (6dfafb6)
  • deps: update dependency @types/jest to v29.5.13 (1de1b8a)
  • deps: update dependency @types/jest to v29.5.14 (30cd519)
  • deps: update dependency @types/node to v20.12.10 (78f9456)
  • deps: update dependency @types/node to v20.12.11 (a7871f4)
  • deps: update dependency @types/node to v20.12.12 (b2997da)
  • deps: update dependency @types/node to v20.12.13 (8876227)
  • deps: update dependency @types/node to v20.12.5 (ca49751)
  • deps: update dependency @types/node to v20.12.6 (4347927)
  • deps: update dependency @types/node to v20.12.7 (9c2357b)
  • deps: update dependency @types/node to v20.12.8 (3e86607)
  • deps: update dependency @types/node to v20.13.0 (8bc9e52)
  • deps: update dependency @types/node to v20.14.0 (846691e)
  • deps: update dependency @types/node to v20.14.1 (be4afcd)
  • deps: update dependency @types/node to v20.14.10 (ef14320)
  • deps: update dependency @types/node to v20.14.11 (b60d875)
  • deps: update dependency @types/node to v20.14.12 (6eca2e0)
  • deps: update dependency @types/node to v20.14.13 (1eb978b)
  • deps: update dependency @types/node to v20.14.14 (f5ba29b)
  • deps: update dependency @types/node to v20.14.15 (636d854)
  • deps: update dependency @types/node to v20.14.2 (d4dddeb)
  • deps: update dependency @types/node to v20.14.4 (39d6891)
  • deps: update dependency @types/node to v20.14.5 (e337fc5)
  • deps: update dependency @types/node to v20.14.6 (4d5849a)
  • deps: update dependency @types/node to v20.14.7 (312df9f)
  • deps: update dependency @types/node to v20.14.8 (2c8dd30)
  • deps: update dependency @types/node to v20.14.9 (18af32b)
  • deps: update dependency @types/node to v20.15.0 (7ddf6d9)
  • deps: update dependency @types/node to v20.16.1 (ce067ef)
  • deps: update dependency @types/node to v20.16.10 (34fe6e2)
  • deps: update dependency @types/node to v20.16.11 (6c68d92)
  • deps: update dependency @types/node to v20.16.12 (8eae99a)
  • deps: update dependency @types/node to v20.16.13 (716b77b)
  • deps: update dependency @types/node to v20.16.14 (49e621c)
  • deps: update dependency @types/node to v20.16.15 (518d610)
  • deps: update dependency @types/node to v20.16.2 (35b662e)
  • deps: update dependency @types/node to v20.16.3 (71f95ab)
  • deps: update dependency @types/node to v20.16.4 (6141a63)
  • deps: update dependency @types/node to v20.16.5 (1dd5130)
  • deps: update dependency @types/node to v20.16.6 (0d4e172)
  • deps: update dependency @types/node to v20.16.7 (0a3d240)
  • deps: update dependency @types/node to v20.16.9 (d7ea710)
  • deps: update dependency @types/node to v20.17.0 (3823c7b)
  • deps: update dependency @types/node to v20.17.1 (7b7275d)
  • deps: update dependency chai to v4.5.0 (91967d3)
  • deps: update dependency eslint to v8.57.1 (082e62e)
  • deps: update dependency eslint-plugin-prettier to v5.2.1 (a82c504)
  • deps: update dependency prettier to v3.3.0 (c2f087d)
  • deps: update dependency prettier to v3.3.1 (9d705d5)
  • deps: update dependency prettier to v3.3.2 (074ceba)
  • deps: update dependency prettier to v3.3.3 (8dc9d1e)
  • deps: update dependency sinon to v17.0.2 (fec3b54)
  • deps: update dependency ts-jest to v29.1.3 (958dc3d)
  • deps: update dependency ts-jest to v29.1.4 (42bc711)
  • deps: update dependency ts-jest to v29.1.5 (eb5d897)
  • deps: update dependency ts-jest to v29.2.0 (a6285d2)
  • deps: update dependency ts-jest to v29.2.1 (407ac3c)
  • deps: update dependency ts-jest to v29.2.2 (712f807)
  • deps: update dependency ts-jest to v29.2.3 (7d99dc8)
  • deps: update dependency ts-jest to v29.2.4 (89317c8)
  • deps: update dependency ts-jest to v29.2.5 (c3ab980)
  • deps: update dependency typescript to v5.4.5 (a32d0d5)
  • deps: update dependency typescript to v5.5.2 (b6001f0)
  • deps: update dependency typescript to v5.5.3 (ce63267)
  • deps: update dependency typescript to v5.5.4 (169eed7)
  • deps: update dependency typescript to v5.6.2 (a071dac)
  • deps: update dependency typescript to v5.6.3 (1f99a83)

3.1.7 (2024-04-08)

🛠 Builds

⚙️ Continuous Integrations

  • action: prevent duplicate checks on Renovate PRs (#784) (6b56a36)
  • action: update actions/setup-node digest to 60edb5d (#821) (f05b75e)
  • action: update actions/upload-artifact action to v4 (#856) (46d6660)
  • action: update amannn/action-semantic-pull-request digest to e9fabac (#849) (d96457c)
  • action: update github/codeql-action action to v2.22.6 (#783) [skip ci] (687fd43)
  • action: update github/codeql-action action to v2.22.7 (#787) (a0204d8)
  • action: update github/codeql-action action to v2.22.8 (#797) (323f48c)
  • action: update github/codeql-action action to v3 (#817) (69d2695)
  • action: update insurgent-lab/is-in-pr-action action to v0.1.4 (#790) (8e85b13)
  • action: update insurgent-lab/is-in-pr-action action to v0.1.5 (#798) (76751d2)
  • action: update insurgent-lab/is-in-pr-action action to v0.2.0 (#853) (cc3fcbd)
  • action: update marocchino/sticky-pull-request-comment digest to 331f8f5 (#850) (a477f08)
  • action: update step-security/harden-runner action to v2.6.1 (#788) [skip ci] (2e5ca52)
  • action: update step-security/harden-runner action to v2.7.0 (#846) (f1a8486)
  • fix renovate skipping checks (#796) (3b00555)

♻️ Chores

3.1.6 (2023-10-29)

🐛 Bug Fixes

⚙️ Continuous Integrations

  • action: update actions/checkout action to v4 (#755) (d0d70c6)
  • action: update github/codeql-action action to v2.22.4 (#752) (04454c3)
  • action: update github/codeql-action action to v2.22.5 (#758) (2dff183)
  • action: update ossf/scorecard-action action to v2.3.1 (#754) (41d21f1)

♻️ Chores

3.1.5 (2023-10-26)

🐛 Bug Fixes

  • detect multiple zeros as an invalid step (#743) [skip ci] (b0bf677)
  • re-add runOnce property to CronJob (#751) (a61d8c9)

📚 Documentation

  • readme: API documentation overhaul (#716) [skip ci] (23fb0a3)

⚙️ Continuous Integrations

  • action: update actions/setup-node action to v4 (#749) (ef850f3)

♻️ Chores

3.1.4 (2023-10-24)

🐛 Bug Fixes

  • run once when actual date is given to setTime (#740) (ee54dd5)

⚙️ Continuous Integrations

  • action: update actions/checkout action to v4 (#735) (144ba67)

♻️ Chores

3.1.3 (2023-10-19)

🐛 Bug Fixes

⚙️ Continuous Integrations

  • renovate: update configuration (#732) [skip ci] (2ff9c6e)

3.1.2 (2023-10-19)

🛠 Builds

  • deps: update dependency luxon to ~3.4.0 (#730) (c3806c5)

♻️ Chores

3.1.1 (2023-10-12)

🐛 Bug Fixes

  • fix lastDate() value for intervals > 25 days (#711) (141aa00)
  • fix object constructor typings & make OC generic type optional (#712) (6536084)

📚 Documentation

  • readme: update nextDates documentation (#702) (1ad2e22)

3.1.0 (2023-10-09)

✨ Features

  • improve context, onTick & onComplete typings (#705) (82c78d7)

🚨 Tests

  • check at runtime that all tests call expect (#706) [skip ci] (cc4e62f)

♻️ Chores

  • deps: update semantic-release related packages (#709) [skip ci] (b94a48a)
  • reflect repository label changes (#708) (85c9e18)

3.0.0 (2023-09-30)

⚠ Breaking changes

  • utcOffset parameter no longer accepts a string
  • utcOffset values between -60 and 60 are no longer treated as hours
  • providing both timeZone and utcOffset parameters now throws an error
  • removed cron.job() method in favor of new CronJob(...args) / CronJob.from(argsObject)
  • removed cron.time() method in favor of new CronTime()
  • CronJob: constructor no longer accepts an object as its first and only params. Use CronJob.from(argsObject) instead.
  • CronJob: callbacks are now called in the order they were registered
  • return empty array from nextDates when called without argument (#519)
  • UNIX standard alignments (#667)

✨ Features

🐛 Bug Fixes

  • return empty array from nextDates when called without argument (#519) (c2891ba)

📦 Code Refactoring

📚 Documentation

  • readme: remove outdated informations (#695) (b5ceaf1)

🚨 Tests

  • update new test for cron standard alignments (4a406c1)

♻️ Chores

💎 Styles

2.4.4 (2023-09-25)

🐛 Bug Fixes

2.4.3 (2023-08-26)

🐛 Bug Fixes

  • fix range parsing when upper limit = 0 (#687) (d96746f)

🚨 Tests

2.4.2 (2023-08-26)

🐛 Bug Fixes

2.4.1 (2023-08-14)

🐛 Bug Fixes

  • replace loop timeout by max match date (#686) (c685c63)

⚙️ Continuous Integrations

2.4.0 (2023-07-24)

✨ Features

🐛 Bug Fixes

  • don't start job in setTime if it wasn't running (7e26c23)

🛠 Builds

  • npm: ship type definitions with releases (0b663a8)

🚨 Tests

  • add test case for #598 fix (4322ef2)
  • don't stop/start job before using setTime (f0d5d3f)

⚙️ Continuous Integrations

  • add support for beta & maintenance releases (#677) (c6fc842)
  • setup conventional commits & release automation (#673) (c6f39ff)

♻️ Chores

  • update default branch name (#678) (7471e95)
  • wrap setTime tests in describe and move down (31989e0)

v2.3.1 (2023-05-25)

Added

  • Logo!
  • New test cases

Fixed

  • Linting issues

v2.3.0 (2023-03-14)

Fixed

  • Some small bugs

Changed

  • Refactored get next date function

v2.2.0 (2023-01-09)

Changed

  • Updated Luxon dependency
  • Updated unit tests to be compatible with new Luxon version

v2.1.0 (2022-07-14)

Changed

  • "Maximum iterations" will direct the user to refer to a single canonical issue instead of creating a new one

v2.0.0 (2022-05-03)

  • Upgrade vulnerable dependencies
  • Move from moment.js to luxon (breaking change)

v1.8.2 (2020-01-24)

  • Fix syntax parsing bug

v1.8.1 (2020-01-19)

  • Revert TS definition defaulting to DefinitelyTyped definitions.

v1.8.0 (2020-01-19)

  • GH-454 - Range upper limit should default to highest value when step is provided by Noah May noahmouse2011@gmail.com in d36dc9581f9f68580a2016b368f8002a9f1e357d

v1.7.1 (2019-04-26)

  • GH-416 - Fix issue where next execution time is incorrect in some cases in Naoya Inada naoina@kuune.org in c08522ff80b3987843e9930c307b76d5fe38b5dc

v1.7.0 (2019-03-19)

  • GH-408 - DST issue by Shua Talansky shua@bitbean.com in 1e971fd6dfa6ba4b0469d99dd64e6c31189d17d3 and 849a2467d16216a9dfa818c57cc26be6b6d0899b

v1.6.0 (2018-11-15)

  • GH-393, GH-394 - Remove hard limit on max iters in favor of a timeout by Nick Campbell nicholas.j.campbell@gmail.com in 57632b0c06c56e82f40b740b8d7986be43842735
  • GH-390 - better handling of real dates which are in the past by Nick Campbell nicholas.j.campbell@gmail.com in 7cbcc984aea6ec063e38829f68eb9bc0dfb1c775