Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
= facebook_distance_of_time_in_words facebook_distance_of_time_in_words helps you to display time distance just like Facebook does == Install `script/plugin install git://github.com/cedricbousmanne/facebook_distance_of_time_in_words.git` == Usage In your view: <%= facebook_distance_of_time_in_words(@object.created_at) %> == Examples <% dates = [ Time.now-1.minute, Time.now-5.minutes, Time.now-33.minutes, Time.now-1.hour, Time.now-1.4.hours, Time.now-1.6.hours, Time.now-3.hours, Time.now-23.hours, Time.now-1.day, Time.now-1.day-12.hours, Time.now-2.days, Time.now-3.days, Time.now-4.days, Time.now-5.days, Time.now-6.days, Time.now-7.days, Time.now-1.month, Time.now-1.year, ] %> <% for date in dates -%> <%= facebook_distance_of_time_in_words(date) %><br /> <% end -%> === Produces #: Now = Wednesday, 7:35 PM today at 7:34pm<br /> today at 7:30pm<br /> today at 7:02pm<br /> about one hour ago<br /> about one hour ago<br /> about 2 hours ago<br /> about 3 hours ago<br /> yesterday at 8:35pm<br /> yesterday at 7:35pm<br /> yesterday at 7:35am<br /> Mon at 7:35pm<br /> Sun at 7:35pm<br /> Sat at 7:35pm<br /> Fri at 7:35pm<br /> Thu at 7:35pm<br /> 7 days ago<br /> January 11 at 7:35pm<br /> February 11, 2009<br /> == Localization facebook_distance_of_time_in_words uses i18n to display time distance. For now, only french and english are available. If you're able to translate the localization files into others languages, feel free to contact me and i'll add your contribution to the project. == Contact This plugin has been written by Cédric Bousmanne. You can find contact information on my personnal page : http://cedricbousmanne.com/