node-cron
node-cron copied to clipboard
feat: [435] add support for extended cron syntax
Description
Related Issue
#435
Motivation and Context
How Has This Been Tested?
Added more unit tests.
Screenshots (if appropriate):
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a
!after the type/scope in the title (see the Conventional Commits standard).
@sheerlox need a clarification for this feature:
L: The letter L can be used in the day of the month field to indicate the last day of the month. When used in the day of the week field in conjunction with the # character, it denotes the last specific weekday of the month. For example, 5#L represents the last Friday of the month.
Do I understand this right? Let's say the 5#L resolves to Friday, 25th of Jan. Does this lead to (* * 25 * FRI) ?
Not really, because day-of-month and day-of-week work as a union and not an intersection. So basically the {x}#L string is a feature of its own.
Having said that, it would be nice to have the option to enable treating them as intersections if you think that'd be a good way of implementing {x}#L.
But that's a feature of its own, and implementing {x}#L should be way more straightforward.
@alexanderkrum are you still interested in working on this PR?
i need the L syntax to run on the n-th last day of each month, for example L-1 would run 1 day before the last day of the month, if the month has 30 days then it would run on 29th, if the month has 31 days then it would run on 30th
seems like this syntax already exists, i can see it on this cron expression generator, but it is not implemented in this library yet
does anyone have an idea for a workaround while waiting for this feature?