Anyone know of a humanised date difference plugin/script

I’m looking for something that when given two dates would give me
something like ‘3 days ago’ or ‘2 hours ago’ etc. I’ve done quite a
bit of searching and either I’m not searching on the right stuff or
there is nothing out there.

I’m looking for something that when given two dates would give me
something like ‘3 days ago’ or ‘2 hours ago’ etc. I’ve done quite a
bit of searching and either I’m not searching on the right stuff or
there is nothing out there.

From Rails istelf (1.2.5 docs)

distance_of_time_in_words(from_time, to_time = 0, include_seconds =
false)

Reports the approximate distance in time between two Time or Date
objects
or integers as seconds. Set include_seconds to true if you want more
detailed approximations when distance < 1 min, 29 secs Distances are
reported base on the following table:

0 <-> 29 secs # => less than a minute 30 secs <-> 1 min, 29 secs # => 1
minute 1 min, 30 secs <-> 44 mins, 29 secs # => [2…44] minutes 44 mins,
30 secs <-> 89 mins, 29 secs # => about 1 hour 89 mins, 29 secs <-> 23
hrs, 59 mins, 29 secs # => about [2…24] hours 23 hrs, 59 mins, 29 secs
<-> 47 hrs, 59 mins, 29 secs # => 1 day 47 hrs, 59 mins, 29 secs <-> 29
days, 23 hrs, 59 mins, 29 secs # => [2…29] days 29 days, 23 hrs, 59
mins,
30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month 59
days,
23 hrs, 59 mins, 30 secs <-> 1 yr minus 31 secs # => [2…12] months 1 yr
minus 30 secs <-> 2 yrs minus 31 secs # => about 1 year 2 yrs minus 30
secs <-> max time or date # => over [2…X] years

With include_seconds = true and the difference < 1 minute 29 seconds 0-4
secs # => less than 5 seconds 5-9 secs # => less than 10 seconds 10-19
secs # => less than 20 seconds 20-39 secs # => half a minute 40-59 secs

=> less than a minute 60-89 secs # => 1 minute

Examples:

from_time = Time.now
distance_of_time_in_words(from_time, from_time + 50.minutes) # =>
about
1 hour
distance_of_time_in_words(from_time, from_time + 15.seconds) # =>
less
than a minute
distance_of_time_in_words(from_time, from_time + 15.seconds, true) #
=>
less than 20 seconds

Note: Rails calculates one year as 365.25 days.

Sweet, I knew I was sure I’d seen it somewhere before but really
couldn’t remember and it was one of those times where what I was
searching for didn’t really describe what I was looking for properly.