Commit a5e74081262577f7d58e66082328548103171c2c
1 parent
a8c13b20
Exists in
master
and in
28 other branches
Fix for event search not finding year or month
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
app/controllers/public/search_controller.rb
... | ... | @@ -79,10 +79,11 @@ class SearchController < PublicController |
79 | 79 | def events |
80 | 80 | @category_id = @category ? @category.id : nil |
81 | 81 | |
82 | - if params[:year] || params[:month] | |
83 | - date = Date.new(year.to_i, month.to_i, 1) | |
84 | - date_range = (date - 1.month)..(date + 1.month).at_end_of_month | |
85 | - end | |
82 | + year = (params[:year] ? params[:year].to_i : Date.today.year) | |
83 | + month = (params[:month] ? params[:month].to_i : Date.today.month) | |
84 | + day = (params[:day] ? params[:day].to_i : Date.today.day) | |
85 | + date = Date.new(year, month, day) | |
86 | + date_range = (date - 1.month)..(date + 1.month).at_end_of_month | |
86 | 87 | |
87 | 88 | if @query.blank? |
88 | 89 | # Ignore pagination for asset events | ... | ... |