Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add distance_of_time_in_words example for seconds

  • Loading branch information...
commit 594997f52b385adea32b9482b0eb40ac6d659480 1 parent be4a44f
@avakhov avakhov authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  actionpack/lib/action_view/helpers/date_helper.rb
View
3  actionpack/lib/action_view/helpers/date_helper.rb
@@ -64,6 +64,9 @@ module DateHelper
# 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)
Please sign in to comment.
Something went wrong with that request. Please try again.