-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow "L" for end of the month in the "day" field of cron #26
Conversation
…ar splits instead of using global replaces
@Congelli501 Thank you for your contribution. Allow me some time to properly review your changes. Meanwhile, one potential issue that I noticed, is that |
Indeed. I see two possible solutions:
|
@roccivic , what do you think about my proposal for units ? What would be your preferred approach ? Did you have the chance to review the other changes ? |
I had a look at the pull request and I agree that it would be nice to support the The current version does allow negative numbers and their use would throw an error. I'm not sure if anyone relies on the module to have this behaviour, but it could be a breaking change for someone. I think that a great starting point would be to add a new option Afterwards, instead of updating the As far as supporting arbitrary negative numbers. Would you to consider putting it behind another option, like Something like this: 4adf18c. Have you checked for any edge cases with ranges of negative numbers? I haven't, but I wonder if the implementation handles these cases correctly since the range separator and the minus sign are the same character |
The I'm not very found in adding a flag to enable the last day parsing, as it limits discoverability. I made the following changes:
This should keep user facing changes to a mimimum. I don't see a usecase for negative numbers other than What do you think about the last changes ? Do you prefer to add an option parameter to |
I think having an option for this feature is unavoidable. We don't really know which underlying cron implementation users are integrating with and whether it supports the As far as the discoverability goes, that's only a matter of whether the option should be enabled or disabled by default. |
Co-authored-by: Rouslan Placella <[email protected]>
I added the new parse option. The last day of month parsing is on by default. |
@Congelli501 Thank you for the contribution. I will publish a new version in the near future. |
@roccivic , sorry to bother you, do you know when the release will be published? |
@Congelli501 No bother at all. I just updated the readme file with the changes from this pull request and realized that while the |
@Congelli501 I published |
The timing allowed me to test it live. |
@Congelli501 That's great, thanks for checking. |
New feature
This PR adds support for :
L
in the day field, to select the last day of the monthL
is just an alias for-1
L
is used for end of month on many cron implementation (source: https://stackoverflow.com/questions/6139189/cron-job-to-run-on-the-last-day-of-the-month).There are no bullet-proof ways to declare "end of month" with the basic cron feature (none that supports leap years).
Internal changes
To allow for the
L
alias, I transformed thealt
Array
into aMap
.