Module: DateAdditions

Included in:
Date, Time
Defined in:
lib/bootstripe/date_additions.rb

Instance Method Summary collapse

Instance Method Details

#future_in_wordsObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/bootstripe/date_additions.rb', line 2

def future_in_words
  the_day = self.to_date
  day_name = the_day.strftime("%A")

  case the_day
    when Date.current then "Today"
    when Date.current + 1 then "Tomorrow"
    
    when the_day <= (Date.current + 6.days).to_date then "this coming #{day_name} the #{the_day.day.ordinalize}"
    when the_day <= (Date.current + 13.days).to_date then "next #{day_name} the #{the_day.day.ordinalize}"
    else "#{the_day.strftime('%A %b')} #{the_day.day.ordinalize}"
  end
end