a5-stable / parse-cron-ext

monkey-patch of https://github.com/siebertm/parse-cron
MIT License
0 stars 0 forks source link

support W notation #4

Closed a5-stable closed 2 years ago

a5-stable commented 2 years ago

I'd like to support W notation.

details: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html

The W wildcard in the Day-of-month field specifies a weekday. In the Day-of-month field, 3W specifies the weekday closest to the third day of the month.

Each next should return following result:

cron_parser = CronParser.new("0 0 * * W")
cron_parser.next("2022-02-10 00:00")
# =>  2022-02-11 00:00

cron_parser = CronParser.new("0 0 * * W")
cron_parser.next("2022-02-11 00:00")
# =>  2022-02-14 00:00
a5-stable commented 2 years ago

released