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].
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.

Reply via email to