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

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

Constant Summary collapse

LONG_FORMAT =
'%m/%d/%Y'
SHORT_FORMAT =
'%d %b %Y'

Instance Method Summary collapse

Instance Method Details

#format_date(date, format: '%m/%d/%Y') ⇒ Object



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

def format_date(date, format: '%m/%d/%Y')
  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