schedule icon indicating copy to clipboard operation
schedule copied to clipboard

fix: cron month starts from 0

Open bangbang93 opened this issue 2 years ago • 0 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
  • [x] Tests for the changes have been added (for bug fixes / features)
  • [x] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Other... Please describe:

What is the current behavior?

cron package count month from 0

So 0 0 1 1 * will run at February 1st, not January 1st.

cron.time('0 0 1 1 *').sendAt().toJSDate()
2023-01-31T16:00:00.000Z

Issue Number: N/A

What is the new behavior?

cron.time('0 0 1 0 *').sendAt().toJSDate()
2022-12-31T16:00:00.000Z

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

https://github.com/kelektiv/node-cron#cron-ranges

bangbang93 avatar Oct 13 '22 12:10 bangbang93