diff --git a/lib/chronic/repeaters/repeater_month_name.rb b/lib/chronic/repeaters/repeater_month_name.rb index 457e0c68..37f52896 100644 --- a/lib/chronic/repeaters/repeater_month_name.rb +++ b/lib/chronic/repeaters/repeater_month_name.rb @@ -29,7 +29,7 @@ def next(pointer) when :future if @now.month < index @current_month_begin = Chronic.construct(@now.year, index) - elsif @now.month > index + elsif @now.month >= index @current_month_begin = Chronic.construct(@now.year + 1, index) end when :none diff --git a/test/test_repeater_month_name.rb b/test/test_repeater_month_name.rb index 45a7c8c4..ac6aa892 100644 --- a/test/test_repeater_month_name.rb +++ b/test/test_repeater_month_name.rb @@ -28,6 +28,14 @@ def test_next assert_equal Time.local(2006, 12), next_december.begin assert_equal Time.local(2007, 1), next_december.end + now_month = Date::MONTHNAMES[@now.month].downcase.to_sym + now_months = Chronic::RepeaterMonthName.new(now_month) + now_months.start = @now + + next_now_month = now_months.next(:future) + assert_equal Time.local(2007, 8), next_now_month.begin + assert_equal Time.local(2007, 9), next_now_month.end + # past mays = Chronic::RepeaterMonthName.new(:may)