Module: ExpireHostsMailerHelper
- Defined in:
- app/helpers/expire_hosts_mailer_helper.rb
Instance Method Summary collapse
Instance Method Details
#relative_date(date, opts = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/expire_hosts_mailer_helper.rb', line 4 def relative_date(date, opts = {}) return _('N/A') if date.blank? opts[:tense] ||= :future if Date.today < date opts[:tense] ||= :past if Date.today > date if opts[:tense] == :future _('in %s') % (time_ago_in_words date) elsif opts[:tense] == :past _('%s ago') % (time_ago_in_words date) else _('today') end end |