Method: Doing::WWID#list_date

Defined in:
lib/doing/wwid/display.rb

#list_date(dates, section, times = nil, output = nil, opt) ⇒ Object

Display entries within a date range

Parameters:

  • dates (Array)

    [start, end]

  • section (String)

    The section

  • times (Bool) (defaults to: nil)

    Show times

  • output (String) (defaults to: nil)

    Output format

  • opt (Hash)

    Additional Options



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/doing/wwid/display.rb', line 105

def list_date(dates, section, times = nil, output = nil, opt)
  opt ||= {}
  opt[:totals] ||= false
  opt[:sort_tags] ||= false
  section = guess_section(section)
  # :date_filter expects an array with start and end date
  dates = dates.split_date_range if dates.instance_of?(String)

  opt[:section] = section
  opt[:count] = 0
  opt[:order] = :asc
  opt[:date_filter] = dates
  opt[:times] = times
  opt[:output] = output

  time_rx = /^(\d{1,2}+(:\d{1,2}+)?( *(am|pm))?|midnight|noon)$/
  if opt[:from] && opt[:from][0].is_a?(String) && opt[:from][0] =~ time_rx
    opt[:time_filter] = opt[:from]
  end

  list_section(opt)
end