1

I am wondering if it's possible to get amount of months in rails from response. If my data contains published.at: '2020-12-31 08:00:00 UTC'. How can I render in my html Published: 3 months ago instead of displaying the entire date? Now I display it as <%= item.published_at %>

Dave
  • 1
  • 1
  • 9
  • 38

1 Answers1

0

You can use time_ago_in_words

Published <%= time_ago_in_words(item.published_at) %> ago
razvans
  • 3,172
  • 7
  • 22
  • 30