Agree, I am just showing what kind of thing works now and how I'd like it to be more like you pointed out.
On Wednesday, January 2, 2013 3:41:25 PM UTC-4, Gosha Arinich wrote: > > You don't take i18n into account. > > Additionally, I would not use method chain or so for this. Instead, I > would just modify `distance_of_time_in_words_to_now` to handle additional > boolean option called `:relative`, and just handle it. > > Cheers, > Gosha Arinich > > On Wednesday, January 2, 2013 at 10:32 PM, Ace Suares wrote: > > I have this now > > module ActionView::Helpers::DateHelper > > def distance_of_time_in_words_to_now_with_future(from_time, > include_seconds = false) > if from_time > Time.now() > 'in ' + distance_of_time_in_words_to_now_without_future(from_time, > include_seconds) > else > distance_of_time_in_words_to_now_without_future(from_time, > include_seconds) + ' ago' > end > end > > alias_method_chain :distance_of_time_in_words_to_now, :future > > end > > > On Wednesday, January 2, 2013 12:35:41 PM UTC-4, Ace Suares wrote: > > Hi There, > > As I have learned the hard way, let me discuss my question, idea or > feature here before doing actual work on it... > > distance_of_time_in_words_to_now() seems to be unable to tell if this > distance is in the future or in the past. > > I'd really like to see 'in 5 days' or '5 days ago' depending on, well, if > it was 5 days ago or will be in 5 days. > > I've googled and saw some gems, one by Radar, but I think this seemingly > simple thing shouldn't be in a gem. > > I'd be happy to hear your comments. > > Cheers > > Ace > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/cDyUxC3RVwkJ. > To post to this group, send email to [email protected]<javascript:> > . > To unsubscribe from this group, send email to > [email protected] <javascript:>. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/H4NATUw92aYJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
