Permalink
Browse files

Update documentation to reflect increased accuracy of date interval c…

…alculations. Closes #7192 [eventualbuddha]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8310 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 6fd1a4d commit b9e0b7279506fe6f847aac2606a5c3d8eb7a6992 Marcel Molina committed Dec 5, 2007
Showing with 3 additions and 4 deletions.
  1. +3 −4 actionpack/lib/action_view/helpers/date_helper.rb
@@ -25,9 +25,9 @@ module DateHelper
# 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
+ # 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 1 sec # => [2..12] months
+ # 1 yr <-> 2 yrs minus 1 secs # => about 1 year
+ # 2 yrs <-> 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
@@ -56,7 +56,6 @@ module DateHelper
# distance_of_time_in_words(to_time, from_time, true) # => over 6 years
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
#
- # Note: Rails calculates one year as 365.25 days.
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
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)

0 comments on commit b9e0b72

Please sign in to comment.