Sha256: 48714f1c6355e2f89011df63ce00b149309ec3cd9b085c8603bb3cc49de1c247
Contents?: true
Size: 722 Bytes
Versions: 14
Compression:
Stored size: 722 Bytes
Contents
require 'tzinfo' module Voom module Presenters module Helpers module Time LONG_FORMAT='%m/%d/%Y %I:%M:%S %p %Z' SHORT_FORMAT='%d %b %H:%M %Z' def format_time(time, format: '%m/%d/%Y %I:%M:%S %p %Z', timezone: nil) return '' unless time time = time.in_time_zone(timezone) if timezone time.strftime(format) end def format_time_long(time, format: nil, timezone: nil) format_time(time, format: format||LONG_FORMAT, timezone: timezone) end def format_time_short(time, format: nil, timezone: nil) format_time(time, format: format||SHORT_FORMAT, timezone: timezone) end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems