Skip to content

Commit

Permalink
Merge pull request #59 from ekampp/add_support_for_bymonthday
Browse files Browse the repository at this point in the history
Add support for bymonthday
  • Loading branch information
rmitchell-sq authored Mar 18, 2024
2 parents ed46ac3 + 6a50280 commit 8fbb739
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/rrule/humanizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ def _byweekday
add list(bynweekday_option, method(:weekdaytext), 'and')
end

def _bymonthday
add 'on the'
add list (bymonthday_option.map { |o| nth(o) }), :to_s, 'and'
end

def _byhour
add 'at'
add list byhour_option, :to_s, 'and'
Expand Down
6 changes: 6 additions & 0 deletions spec/rule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,12 @@

it { expect(rrule.humanize).to eq 'every month on the 1st Monday and last Friday for 7 times' }
end

context 'every month on the 14th' do
let(:rule) { 'FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=14,15' }

it { expect(rrule.humanize).to eq 'every month on the 14th and 15th' }
end
end

describe '#is_finite?' do
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

# Focus with fit, fdescribe, and fcontext
config.filter_run_when_matching :focus
end

Time.zone = 'America/Los_Angeles'

0 comments on commit 8fbb739

Please sign in to comment.