relative_time_helpers Plugin: time_ago_in_words on Steroids
relative_time_helpers is a straightforward, but very useful Rails plugin by Rick Olson that formats timestamps to human-friendly relative dates. You're probably already using Rails' built-in time_ago_in_words helper in your applications, but Rick's relative_time gives even better results:
<%= relative_time(Time.now) %> # today <%= relative_time(1.day.ago) %> # yesterday <%= relative_time(1.day.from_now) %> # tomorrow <%= relative_time_span([Time.now, 5.days.from_now]) %> # May 17th - 22nd
To install it:
script/plugin install http://ar-code.svn.engineyard.com/plugins/relative_time_helpers
June 11, 2007 at 4:59 pm
I was just about to write this same type of plugin. Thanks so much for saving me the trouble!
June 13, 2007 at 7:37 am
Dear Dr J:
Yaay! I'm so happy for you... I do agree with you. It's probably one of the most directly-useful plugins that looks very simple on the surface :-)