Skip to content

Commit

Permalink
fix bug with setting a nil hour
Browse files Browse the repository at this point in the history
  • Loading branch information
nickelser committed May 7, 2015
1 parent 989106d commit f07355c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 0 additions & 7 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,5 @@
require "bundler/setup"
require "zhong"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start
3 changes: 2 additions & 1 deletion lib/zhong/at.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def initialize(minute: nil, hour: nil, wday: nil, grace: 0.minutes)
def next_at(time = Time.now)
at_time = @wday.nil? ? time.dup : (time + (@wday - time.wday).days)

at_time = at_time.change(hour: @hour, min: @minute)
at_time = at_time.change(min: @minute)
at_time = at_time.change(hour: @hour) if @hour

if at_time < @grace.ago
if @wday.nil?
Expand Down

0 comments on commit f07355c

Please sign in to comment.