Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/chronic/repeaters/repeater_month_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/test_repeater_month_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down