Sha256: 3c98a75be6e04fd551386d574fb7f394de48c2a5068a61743ee0b3170a0cb858

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 Bytes

Contents

module ApplicationHelper
  # Long date format
  #
  # @param date [Date] the date object
  # @return day date month year - hour:minutes AM/PM
  def long_date(date)
    date.strftime("%A %d %B %Y - %H:%M %p") rescue 'unknown'
  end

  # Medium date format
  #
  # @param date [Date] the date object
  # @return month/date/year at hour:minutes AM/PM
  def medium_date(date)
    date.strftime("%m/%d/%Y at %H:%M %p") rescue 'unknown'
  end

  # Another style of medium date format
  #
  # @param date [Date] the date object
  # @return day/MONTH/YEAR
  # Produces -> 18 October 2015
  def medium_date2(date)
    date.strftime("%d %B %Y") rescue 'unknown'
  end

  # Short date format
  #
  # @param date [Date] the date object
  # @return year-month-date
  def short_date(date)
    date.strftime("%Y-%m-%d") rescue 'unknown'
  end

  # US date format
  #
  # @param date [Date] the date object
  # @return year-month-date
  def us_date(date)
    date.strftime("%m/%d/%Y at %H:%M %p") rescue 'unknown'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
myrails-7.0.0 lib/myrails/templates/rails/app/helpers/application_helper.rb