Class: Tenon::EventDecorator

Inherits:
ApplicationDecorator show all
Defined in:
app/decorators/tenon/event_decorator.rb

Instance Method Summary collapse

Methods inherited from ApplicationDecorator

#delete_link, #edit_link, #edit_path, #path, #published?

Instance Method Details

#display_dateObject



3
4
5
6
7
8
9
# File 'app/decorators/tenon/event_decorator.rb', line 3

def display_date
  if @object.starts_at.to_date == @object.ends_at.to_date
    "#{@object.starts_at.strftime('%B %d, %Y')} from #{@object.starts_at.strftime('%I:%M%p')} until #{@object.ends_at.strftime('%I:%M%p')}"
  else
    "#{@object.starts_at.strftime("%B %d, %Y at %I:%M%p")} until #{@object.ends_at.strftime("%B %d, %Y at %I:%M%p")}"
  end
end