Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/doing/helpers.rb

Instance Method Summary collapse

Instance Method Details

#relative_dateObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/doing/helpers.rb', line 5

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