aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2007-12-05 21:38:02 +0000
committerMarcel Molina <marcel@vernix.org>2007-12-05 21:38:02 +0000
commitb9e0b7279506fe6f847aac2606a5c3d8eb7a6992 (patch)
treecf613154d8c3327ce6346b5f0f93eeae064dfa3e /actionpack
parent6fd1a4d502b724d198fd42ee59d8271b7a4f3362 (diff)
downloadrails-b9e0b7279506fe6f847aac2606a5c3d8eb7a6992.tar.gz
rails-b9e0b7279506fe6f847aac2606a5c3d8eb7a6992.tar.bz2
rails-b9e0b7279506fe6f847aac2606a5c3d8eb7a6992.zip
Update documentation to reflect increased accuracy of date interval calculations. Closes #7192 [eventualbuddha]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8310 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rwxr-xr-xactionpack/lib/action_view/helpers/date_helper.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index 734156b474..c2091dfd49 100755
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -25,9 +25,9 @@ module ActionView
# 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 ActionView
# 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)