Welcome to mirror list, hosted at ThFree Co, Russian Federation.

time_frame_filter.rb « concerns « finders « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1ebed730f6e665e7d9bfedc7197597b1ce0b1db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module TimeFrameFilter
  def by_timeframe(items)
    return items unless params[:start_date] && params[:start_date]

    start_date = params[:start_date].to_date
    end_date = params[:end_date].to_date

    items.within_timeframe(start_date, end_date)
  rescue ArgumentError
    items
  end

  def containing_date(items)
    return items unless params[:containing_date]

    date = params[:containing_date].to_date
    items.within_timeframe(date, date)
  end
end