Skip to content

Commit

Permalink
Merge pull request #56 from wishdev/ranges
Browse files Browse the repository at this point in the history
Allow for 45/30 range notation
  • Loading branch information
jmettraux authored May 21, 2021
2 parents 10295b3 + aecc4f5 commit 52a2b7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/fugit/cron.rb
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ def expand(min, max, r)

sla = nil if sla == 1 # don't get fooled by /1

edn = max if sla && edn.nil?

return [ nil ] if sta.nil? && edn.nil? && sla.nil?
return [ sta ] if sta && edn.nil?

Expand Down
4 changes: 4 additions & 0 deletions spec/cron_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
[ '59 18 * * 2#2', '2021-02-09 18:59:00', '2021-02-09 17:41:10' ],
[ '59 18 * * 2#2', '2021-02-09 18:59:00', '2021-02-09 17:41:10', 'UTC' ],
#[ '59 18 * * 2#1', '2021-02-09 18:59:00', '2021-02-09 17:41:10', 'utc' ],

[ '15/30 * * * *', '2021-02-09 19:15:00', '2021-02-09 19:00:00' ],
[ '15/30 * * * *', '2021-02-09 19:45:00', '2021-02-09 19:30:00' ],
[ '15-40/30 * * * *', '2021-02-09 20:15:00', '2021-02-09 19:30:00' ],
]

describe '#next_time' do
Expand Down

0 comments on commit 52a2b7e

Please sign in to comment.