Commit 6dae749cd03b2864a6ed12061b1869954a9eeaf3
1 parent
51fd552d
Exists in
master
and in
29 other branches
time-ago-as-sentence: convert from_time to Time
Showing
1 changed file
with
1 additions
and
0 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1149,6 +1149,7 @@ module ApplicationHelper | @@ -1149,6 +1149,7 @@ module ApplicationHelper | ||
1149 | #FIXME Use time_ago_in_words instead of this method if you're using Rails 2.2+ | 1149 | #FIXME Use time_ago_in_words instead of this method if you're using Rails 2.2+ |
1150 | def time_ago_as_sentence(from_time, include_seconds = false) | 1150 | def time_ago_as_sentence(from_time, include_seconds = false) |
1151 | to_time = Time.now | 1151 | to_time = Time.now |
1152 | + from_time = Time.parse(from_time.to_s) | ||
1152 | from_time = from_time.to_time if from_time.respond_to?(:to_time) | 1153 | from_time = from_time.to_time if from_time.respond_to?(:to_time) |
1153 | to_time = to_time.to_time if to_time.respond_to?(:to_time) | 1154 | to_time = to_time.to_time if to_time.respond_to?(:to_time) |
1154 | distance_in_minutes = (((to_time - from_time).abs)/60).round | 1155 | distance_in_minutes = (((to_time - from_time).abs)/60).round |