Sha256: ce123c5edf43b1113e8f09c50718bdb626b43ceadc6dd4188f39642a775f7d0a
Contents?: true
Size: 709 Bytes
Versions: 12
Compression:
Stored size: 709 Bytes
Contents
require 'tzinfo' module Coprl 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: LONG_FORMAT, 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
12 entries across 12 versions & 1 rubygems