Method: Merbiful::RelativeTimeHelpers#relative_date
- Defined in:
- lib/merbiful-release/relative_time.rb
#relative_date(time) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/merbiful-release/relative_time.rb', line 54 def relative_date(time) date = time.to_date today = time_class.now.to_date if date == today time_output[:today] elsif date == (today - 1) time_output[:yesterday] elsif date == (today + 1) time_output[:tomorrow] else fmt = time_output[:initial_format].dup fmt << time_output[:year_format] unless date.year == today.year time.strftime_ordinalized(fmt) end end |