Sha256: 2a4adf38e0c77697df460075e032acec001a69f6deb78aa34e24aa7ea0bf1cb9
Contents?: true
Size: 906 Bytes
Versions: 14
Compression:
Stored size: 906 Bytes
Contents
module Parliament module Grom module Decorator module Helpers # Namespace for date helper methods module DateHelper # Format start_date and end_date into a readable string # @param [String] date_format a string that represents the format we want to use for the date # @example Format a node with an end_date with the date format YYYY-MM-DD # "grom_node_instance.date_range('%Y-%m-%d)" #=> "2010-01-01 to 2015-01-01" def date_range(date_format: '%-e %b %Y') return '[Date unavailable]' if start_date.nil? if end_date "#{I18n.l(start_date, format: date_format)} #{I18n.t('to')} #{I18n.l(end_date, format: date_format)}" else "#{I18n.l(start_date, format: date_format)} #{I18n.t('to_present')}" end end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems