ActionView::Helpers::DateHelper

time_ago_in_words

API docs (Rails 8.1.4.1) ↗

Alias: distance_of_time_in_words_to_now

def time_ago_in_words(from_time, options = {})

Description

Returns the difference from the current time as a string such as "3 days".

Arguments

Changing a value updates the ERB and HTML.

Turns the difference from the current time into a string, the same way as distance_of_time_in_words. A future time gives the same string.
options= {}
Same as distance_of_time_in_words.
Uses this locale's translations instead of the current one.
:"datetime.custom"
Looks up the translations (x_minutes, etc.) under this scope instead of datetime.distance_in_words. This page's example scope is not in this site's translations, so it returns a "translation missing" string.
Other options are ignored. They do not become HTML attributes either.

ERB

Changes from the previous output: Added Removed Changed


          

HTML