Module: CalMonthsHelper

Defined in:
app/helpers/cal_months_helper.rb

Instance Method Summary collapse

Instance Method Details

#pretty_from_to(event) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'app/helpers/cal_months_helper.rb', line 2

def pretty_from_to(event)
  dtstart, dtend =  event[:start_datetime], event[:end_datetime]
  if dtstart.to_date == dtend.to_date
    "#{dtstart.strftime('%A, %d %b, %H:%M')} - " +
      "#{dtend.strftime('%H:%M')}"
  else
    [dtstart, dtend].map { |dt| dt.strftime('%A, %d %b, %H:%M') }
      .join(' - ')
  end
end