Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace cron with cron parser #16

Merged
merged 3 commits into from
Dec 6, 2020

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Dec 5, 2020

This is the pendant to agenda/agenda#1150

Switching from ncb000gt/node-cron to harrisiirak/cron-parser for cron-pattern parsing.

Previously month was 0-based (0=January). Going forward standard Unix pattern is used, which is 1-based (1=January).

Please update existing cron-patterns that specify a month (4th position of a pattern). The month is now 1 - 12

1 = January

2 = February

3...

| Example | Execute on 1st of January |
|---------|---------------------------|
| Old     | 0 0 1 **0** *             |
| New     | 0 0 1 **1** *             |

old Cron patterns

```
* * * * * *
| | | | | |
| | | | | +-- Year              (range: 1900-3000)
| | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 0-11) NOTE: Difference here
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)
```

new cron patterns

```
* * * * * *
| | | | | |
| | | | | +-- Year              (range: 1900-3000)
| | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12) NOTE: Difference here
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)
```

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Dec 5, 2020

Also updated some packages.

src/utils/nextRunAt.ts Outdated Show resolved Hide resolved
src/utils/nextRunAt.ts Outdated Show resolved Hide resolved
src/types/ArgumentsType.ts Outdated Show resolved Hide resolved
… to [harrisiirak/cron-parser](https://www.npmjs.com/package/cron-parser) for cron-pattern parsing.

    Previously month was 0-based (0=January). Going forward standard Unix pattern is used, which is 1-based (1=January).

    Please update existing cron-patterns that specify a month (4th position of a pattern). The month is now 1 - 12

    1 = January

    2 = February

    3...

    | Example | Execute on 1st of January |
    |---------|---------------------------|
    | Old     | 0 0 1 **0** *             |
    | New     | 0 0 1 **1** *             |

    old Cron patterns

    ```
    * * * * * *
    | | | | | |
    | | | | | +-- Year              (range: 1900-3000)
    | | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
    | | | +------ Month of the Year (range: 0-11) NOTE: Difference here
    | | +-------- Day of the Month  (range: 1-31)
    | +---------- Hour              (range: 0-23)
    +------------ Minute            (range: 0-59)
    ```

    new cron patterns

    ```
    * * * * * *
    | | | | | |
    | | | | | +-- Year              (range: 1900-3000)
    | | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
    | | | +------ Month of the Year (range: 1-12) NOTE: Difference here
    | | +-------- Day of the Month  (range: 1-31)
    | +---------- Hour              (range: 0-23)
    +------------ Minute            (range: 0-59)
    ```
@simllll simllll merged commit e5c3bf1 into hokify:master Dec 6, 2020
@Uzlopak Uzlopak deleted the replace-cron-with-cron-parser branch December 6, 2020 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants