Module: Voom::Presenters::Helpers::Date

Included in:
Voom::Presenters::Helpers
Defined in:
lib/voom/presenters/helpers/date.rb

Constant Summary collapse

LONG_FORMAT =
'%B %e, %Y'
SHORT_FORMAT =
'%e %b'

Instance Method Summary collapse

Instance Method Details

#format_date(date, format: LONG_FORMAT) ⇒ Object



8
9
10
# File 'lib/voom/presenters/helpers/date.rb', line 8

def format_date(date, format: LONG_FORMAT)
  date ? date.strftime(format) : ''
end

#format_date_long(time, format: nil) ⇒ Object



12
13
14
# File 'lib/voom/presenters/helpers/date.rb', line 12

def format_date_long(time, format: nil)
  format_date(time, format: format||LONG_FORMAT)
end

#format_date_short(time, format: nil) ⇒ Object



16
17
18
# File 'lib/voom/presenters/helpers/date.rb', line 16

def format_date_short(time, format: nil)
  format_date(time, format: format||SHORT_FORMAT)
end