Skip to content

Commit

Permalink
Document Cron#next_time and #previous_time arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Feb 16, 2024
1 parent 19aa8f7 commit 3a0253c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,15 @@ c = Fugit::Cron.new('0 0 * * sun')

p Time.now # => 2017-01-03 09:53:27 +0900

p c.next_time # => 2017-01-08 00:00:00 +0900
p c.previous_time # => 2017-01-01 00:00:00 +0900
p c.next_time.to_s # => 2017-01-08 00:00:00 +0900
p c.previous_time.to_s # => 2017-01-01 00:00:00 +0900

p c.next_time(Time.parse('2024-06-01')).to_s
# => "2024-06-02 00:00:00 +0900"
p c.previous_time(Time.parse('2024-06-01')).to_s
# => "2024-05-26 00:00:00 +0900"
#
# `Fugit::Cron#next_time` and `#previous_time` accept a "start time"

p c.brute_frequency # => [ 604800, 604800, 53 ]
# [ delta min, delta max, occurrence count ]
Expand Down

0 comments on commit 3a0253c

Please sign in to comment.