adjust filters

This commit is contained in:
Pete Matsyburka
2024-11-23 01:45:10 +02:00
parent b86aac86d1
commit 9beaaa0851
28 changed files with 410 additions and 304 deletions
-17
View File
@@ -115,21 +115,4 @@ class ApplicationController < ActionController::Base
redirect_to request.url.gsub('.co/', '.com/'), allow_other_host: true, status: :moved_permanently
end
def date_range(key)
p = params.permit(key => %i[from to]).fetch(key, {})
timezone = ActiveSupport::TimeZone[current_account.timezone] || Time.zone
start_date = timezone.parse(p[:from]) if p[:from].present?
end_date = timezone.parse(p[:to]) if p[:to].present?
if start_date.present? && end_date.present? && start_date < end_date
start_date..end_date
elsif start_date.present? && end_date.present? && start_date == end_date
start_date.beginning_of_day..end_date.end_of_day
elsif start_date.present?
start_date..
elsif end_date.present?
..end_date
end
end
end