Module: Voom::Presenters::Helpers::Time
- Included in:
- Voom::Presenters::Helpers
- Defined in:
- lib/voom/presenters/helpers/time.rb
Constant Summary collapse
- LONG_FORMAT =
'%m/%d/%Y %I:%M:%S %p %Z'
- SHORT_FORMAT =
'%d %b %H:%M %Z'
Instance Method Summary collapse
- #format_time(time, format: LONG_FORMAT, timezone: nil) ⇒ Object
- #format_time_long(time, format: nil, timezone: nil) ⇒ Object
- #format_time_short(time, format: nil, timezone: nil) ⇒ Object
Instance Method Details
#format_time(time, format: LONG_FORMAT, timezone: nil) ⇒ Object
10 11 12 13 14 |
# File 'lib/voom/presenters/helpers/time.rb', line 10 def format_time(time, format: LONG_FORMAT, timezone: nil) return '' unless time time = time.in_time_zone(timezone) if timezone time.strftime(format) end |
#format_time_long(time, format: nil, timezone: nil) ⇒ Object
16 17 18 |
# File 'lib/voom/presenters/helpers/time.rb', line 16 def format_time_long(time, format: nil, timezone: nil) format_time(time, format: format||LONG_FORMAT, timezone: timezone) end |
#format_time_short(time, format: nil, timezone: nil) ⇒ Object
20 21 22 |
# File 'lib/voom/presenters/helpers/time.rb', line 20 def format_time_short(time, format: nil, timezone: nil) format_time(time, format: format||SHORT_FORMAT, timezone: timezone) end |