Browse Source

Fix date range logic in generate_different_date_within_collection_year method

pull/3029/head
Manny Dinssa 1 month ago
parent
commit
b1222b1935
  1. 4
      app/helpers/collection_time_helper.rb

4
app/helpers/collection_time_helper.rb

@ -55,8 +55,8 @@ module CollectionTimeHelper
end
def generate_different_date_within_collection_year(date, start_date_override = nil, end_date_override = nil)
start_date = start_date_override || collection_start_date(date).to_date
end_date = end_date_override || collection_end_date(date).to_date
start_date = [start_date_override || collection_start_date(date).to_date, collection_start_date(date).to_date].max.to_date
end_date = [end_date_override || collection_end_date(date).to_date, collection_end_date(date).to_date].min.to_date
((start_date..end_date).to_a - [date.to_date]).sample
end
end

Loading…
Cancel
Save