You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As seen below, time_ago_in_words reports about 1 month ago for an almost 2 month difference. I think this needs to be more precise and say less than 2 months ago or something indicating that it is over a month.
That does seem to be misrepresenting the date. Perhaps it could be:
30 days .. 45 days => about 1 month
45 days .. 60 days => about 2 months
61 days plus => current behaviour
Another option (in my opinion) would be to count weeks, as in: 4 weeks, 5 weeks, 6 weeks, about 2 months, etc. The main issue here seems to be that 'about 1 month' is considered to course, and I must admit, its quite a step from "about x days" to "about x months". Counting in weeks would solve that.
If people agree I'm willing to try and make my first pull request for rails. 👍
I've added a fix for this in #5181. I changed that line so that instead of :count => 1 it's :count => (minutes rounded to the nearest hour). So this does exactly what you had in mind: 30-45 days is 1 month, 45-60 days is two months.
As seen below, time_ago_in_words reports about 1 month ago for an almost 2 month difference. I think this needs to be more precise and say less than 2 months ago or something indicating that it is over a month.
$ rails -v
Rails 3.0.9
irb(main):002:0> require 'rubygems'
=> nil
irb(main):003:0> require 'action_view'
=> nil
irb(main):004:0> include ActionView::Helpers::DateHelper
=> Object
irb(main):002:0> require 'rubygems'
=> nil
irb(main):003:0> require 'action_view'
=> nil
irb(main):004:0> include ActionView::Helpers::DateHelper
=> Object
irb(main):005:0> a=Date.new(2011, 9, 9)
=> Fri, 09 Sep 2011
irb(main):006:0> time_ago_in_words(a)
=> "about 1 month"
irb(main):007:0> Date.today
=> Mon, 07 Nov 2011
The text was updated successfully, but these errors were encountered: