Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/doing/time.rb
Overview
Date helpers
Instance Method Summary collapse
Instance Method Details
#relative_date ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/doing/time.rb', line 6 def relative_date if self > Date.today.to_time strftime('%_I:%M%P') elsif self > (Date.today - 6).to_time strftime('%a %_I:%M%P') elsif self.year == Date.today.year strftime('%m/%d %_I:%M%P') else strftime('%m/%d/%Y %_I:%M%P') end end |