Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AquaGeek/971658 to your computer and use it in GitHub Desktop.
Save AquaGeek/971658 to your computer and use it in GitHub Desktop.
Rails Lighthouse ticket #3806
From d5ae7531f57c60af879e31616763cb4a031e75c7 Mon Sep 17 00:00:00 2001
From: corey <corey@crt17.home>
Date: Thu, 7 Oct 2010 18:41:26 -0700
Subject: [PATCH] change distance_of_time_to_words to use div instead of /
---
actionpack/lib/action_view/helpers/date_helper.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index f556488..343ddea 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -90,8 +90,8 @@ module ActionView
when 43200..86399 then locale.t :about_x_months, :count => 1
when 86400..525599 then locale.t :x_months, :count => (distance_in_minutes.to_f / 43200.0).round
else
- distance_in_years = distance_in_minutes / 525600
- minute_offset_for_leap_year = (distance_in_years / 4) * 1440
+ distance_in_years = distance_in_minutes.div(525600)
+ minute_offset_for_leap_year = (distance_in_years.div(4)) * 1440
remainder = ((distance_in_minutes - minute_offset_for_leap_year) % 525600)
if remainder < 131400
locale.t(:about_x_years, :count => distance_in_years)
--
1.7.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment