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
Month index (0-11) in cron expressions: Deliberated or Mistake #435
Comments
Hi @kamilmysliwiec. In the link that you passed me appears as a range of values 1-12, and I'm reporting that, that the library uses 0 to 11. |
@kb05 You are right but I guess its not going to change since schedule depends on cron library which has This should be written in the doc. @kamilmysliwiec the URL you have sent is wrong. |
I suggest reporting this to On NestJS docs there is a mention tp that package, so I guess there's nothing to do on our side. |
Thanks @micalevisk Sure, are we talking about same cron lib since: https://github.com/node-cron/node-cron but @nestjs/schedule has dependency on |
oh, then we should update the docs. PRs are more than welcomed |
Sure, what repo? |
https://docs.nestjs.com/techniques/task-scheduling Change that |
Hope the PR is valid. |
I'm submitting a...
The problem is related with the month index in cron expressions, in linux cron jobs the the month has a range between 1-12, being January the 1 and December the 12. But the
@nestjs/schedule
library seem like uses another format in which January is 0 and December is 11.Is this deliberate or is it a mistake?
Current behavior
@Cron('0 12 11 1 *')
Configure a job that will be executed "At 12:00 on day-of-month 11 in February." instead january.
Expected behavior
The job will be executed in january.
Minimal reproduction of the problem with instructions
Configure a service that use the next cron:
What is the motivation / use case for changing the behavior?
I was trying to make a job that would run every 3 months (before quarter ends), and I couldn't get it to work because in january, for example, I was using the index 1 instead 0.
Environment
The objective of the issue is to check if this is the correct functioning, and if so, to document it.
The text was updated successfully, but these errors were encountered: