parse-cron
parse-cron copied to clipboard
parses cron expressions and calculates the next occurence after a given date
Thanks for this handy gem. For my use case, I needed to be able to support a source time with a time zone that is different from the local one....
```ruby > CronParser.new("* * * * 100").next => 2021-11-01 00:00:00 +0100 ``` Other fields seem to raise an exception if the field is out of bound ```ruby > CronParser.new("100 400...
Would you be able to push a version update so I can get the new changes with a gem update command? Thanks!
The gem gives error when parsing `30 7 1-L/2 * *`, in this case stands for **last day of month**.
When using seconds I noticed that the last run were not correct. For example: * Rule (* * * * *) and time 15:15:01, the last execution must be 15:15:00,...
The following produces an incorrect last time: ``` ruby cron_parser = CronParser.new('* * * * *') p "Now: #{Time.now}" p "Last: #{cron_parser.last}" p "Next: #{cron_parser.next}" ``` The output is ```...
Add support for timezone offsets inside cron string inspired by rufus-scheduler
`CronParser.new("1 1 1 1 1").next.strftime '%a'` -> not a Monday ... `CronParser.new("1 1 * 1 1").next.strftime '%a'` works though
use Time.now as default