diff --git a/bin/console b/bin/console index f87f98e..84367e0 100755 --- a/bin/console +++ b/bin/console @@ -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 diff --git a/lib/zhong/at.rb b/lib/zhong/at.rb index 8309ea7..b11eebe 100644 --- a/lib/zhong/at.rb +++ b/lib/zhong/at.rb @@ -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?