Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A simple ruby on rails helper to display time distance just like Facebook
Pull request Compare This branch is 2 commits behind cedricbousmanne:master.
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://`

== Usage

	In your view:
	<%= facebook_distance_of_time_in_words(@object.created_at) %>
== Examples

	<% dates = [,,,,,,,,,,,,,,,,,,
	] %>
	<% 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 :
Something went wrong with that request. Please try again.