# File lib/merb-helpers/date_time_helpers.rb, line 47 def relative_date(time, locale=nil) date = time.to_date today = DateAndTime.time_class.now.to_date if date == today DateAndTime.time_output(:today, locale) elsif date == (today - 1) DateAndTime.time_output(:yesterday, locale) elsif date == (today + 1) DateAndTime.time_output(:tomorrow, locale) else fmt = DateAndTime.time_output(:initial_format, locale).dup fmt << DateAndTime.time_output(:year_format, locale) unless date.year == today.year time.strftime_ordinalized(fmt, locale) end end