method
relative_time_in_words
v8.1.1 -
Show latest stable
- Class:
ActionView::Helpers::DateHelper
relative_time_in_words(from_time, options = {})public
Like time_ago_in_words, but adds a prefix/suffix depending on whether the time is in the past or future. You can use the scope option to customize the translation scope. All other options are forwarded to time_ago_in_words.
relative_time_in_words(3.minutes.from_now) # => "in 3 minutes" relative_time_in_words(3.minutes.ago) # => "3 minutes ago" relative_time_in_words(10.seconds.ago, include_seconds: true) # => "less than 10 seconds ago"
See also #time_ago_in_words