Does natural language date from ruby ​​/ rails?

I need to show natural dates like

  • "a few seconds ago"
  • 21 minutes ago

Is there something built into the rails? Or maybe a third party? It is not difficult to implement, but I do not want to reinvent the wheel.

+3
source share
3 answers

I think you are looking time_ago_in_words

+9
source

An interesting approach to consider is converting time to word on the client side using javascript. This may cause your pages to be cached, but at the same time they will apply to end users.

Darragh Curran javascript , Rails.

, .

+2

Also check for chronic stone

http://chronic.rubyforge.org/

0
source

Source: https://habr.com/ru/post/1713796/


All Articles