aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/date_helper.rb
diff options
context:
space:
mode:
authorAlexey Vakhov <vakhov@gmail.com>2012-04-22 13:20:22 +0400
committerAlexey Vakhov <vakhov@gmail.com>2012-04-22 13:20:22 +0400
commit594997f52b385adea32b9482b0eb40ac6d659480 (patch)
tree49f58e087431fe1675979d6cdf2ce4907d2719f2 /actionpack/lib/action_view/helpers/date_helper.rb
parentbe4a44f1f974e7edf2e602708002599c14ee4e49 (diff)
downloadrails-594997f52b385adea32b9482b0eb40ac6d659480.tar.gz
rails-594997f52b385adea32b9482b0eb40ac6d659480.tar.bz2
rails-594997f52b385adea32b9482b0eb40ac6d659480.zip
Add distance_of_time_in_words example for seconds
Diffstat (limited to 'actionpack/lib/action_view/helpers/date_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/date_helper.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index 1f237cd013..a72ee77e07 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -64,6 +64,9 @@ module ActionView
# distance_of_time_in_words(to_time, from_time, true) # => about 6 years
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
#
+ # distance_of_time_in_words(70) # => 1 minute
+ # distance_of_time_in_words(60*60) # => about 1 hour
+ #
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false, options = {})
from_time = from_time.to_time if from_time.respond_to?(:to_time)
to_time = to_time.to_time if to_time.respond_to?(:to_time)