How to format the default date for timeago_tag

293 Views Asked by At

I'm using the format below to display my time ago but need help understanding how to do the format for the default date format. Using rails-timeago gem:

=timeago_tag Time.zone.now, :nojs => true, :limit => 2.days.ago, lang: :en

print>> 2d

After that it does the yyyy-dd-mm format.

I would like to format the default date like May 22, 2014. There's a (:strftime,'%B %d, %Y') that I've used in other format to display how I wanted it but I'm not sure how the syntax works with the timeago_tag helper.

1

There are 1 best solutions below

0
On

As we discussed in the comments, timeago_tag has a format option, so to get your date in the format "%B %d, %Y":

= timeago_tag Time.zone.now, nojs: true, limit: 2.days.ago, lang: :en, format: "%B %d, %Y"