Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

relative_time_helpers Plugin: time_ago_in_words on Steroids

By Hendy Irawan / June 11, 2007

From Basecamp's screenshot

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( %>
# today
<%= relative_time( %>
# yesterday
<%= relative_time( %>
# tomorrow
<%= relative_time_span([, 5.days.from_now]) %>
# May 17th - 22nd

To install it:

script/plugin install

About Hendy Irawan

Ruby programmer from Indonesia. View all posts by Hendy Irawan →


  1. Dr J says:

    I was just about to write this same type of plugin. Thanks so much for saving me the trouble!

  2. Hendy Irawan says:

    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 :-)

Other Posts to Enjoy

Twitter Mentions