From 8559fb18524041a504f1722e5e3bae8e9c3f62eb Mon Sep 17 00:00:00 2001 From: Yannick Koechlin Date: Mon, 21 Jun 2010 12:03:47 +0200 Subject: [PATCH] distance_of_time_in_words should work with DateTime objects --- 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 7d7b6a1..9ddeef8 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -65,8 +65,8 @@ module ActionView 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) - distance_in_minutes = (((to_time - from_time).abs)/60).round - distance_in_seconds = ((to_time - from_time).abs).round + distance_in_minutes = (((to_time.to_i - from_time.to_i).abs)/60).round + distance_in_seconds = ((to_time.to_i - from_time.to_i).abs).round I18n.with_options :locale => options[:locale], :scope => :'datetime.distance_in_words' do |locale| case distance_in_minutes -- 1.7.0.4