kelektiv / node-cron

Cron for NodeJS.
MIT License
8.3k stars 617 forks source link

feat: [435] add support for extended cron syntax #877

Open alexanderkrum opened 2 months ago

alexanderkrum commented 2 months ago

Description

Related Issue

435

Motivation and Context

How Has This Been Tested?

Added more unit tests.

Screenshots (if appropriate):

Types of changes

Checklist:

alexanderkrum commented 2 months ago

@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) ?

sheerlox commented 2 months ago

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.

sheerlox commented 2 months ago

But that's a feature of its own, and implementing {x}#L should be way more straightforward.