Code Monkey home page Code Monkey logo

facebook_distance_of_time_in_words's Introduction

= 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/

facebook_distance_of_time_in_words's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.