39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/fortnight.rb', line 39
def fortnight_in_words
date = self.created_at.to_date
month_begin = date.beginning_of_month
half_month = month_begin.advance(days: 14)
if date.day >= 1 && date.day <=15
output = I18n.l(month_begin, format: :long)
output << ' - '
output << I18n.l(half_month.to_date, format: :long)
else
output = I18n.l((half_month + 1.day).to_date, format: :long)
output << ' - '
output << I18n.l(date.end_of_month, format: :long)
end
output
end
|