This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Donokami
Donokami

Hello,
I'm working on a blog, and for an aesthetic purpose, I would like to show relative date instead of normal date.
Here is how I would implement that in different partials (like blog/posts partial:

<!-- Instead of -->
{{ post.published_at|date('d M. Y') }} 
<!-- (Shows "17 Feb. 2019") -->
{{ post.published_at|relativeDate }} <!-- or --> {{ relativeDate(post.published_at) }}
<!-- (Shows "2 days ago") -->

I a bit a newbie, and I don't know how I could implement my function for the whole theme, in the most optimized way.
What would be the best practice for this?
Thanks!

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.