I’d like to display relative dates in a Kirby template. I already have set up blueprints to accept dates, which I can output like this:
$page->date('j M Y');
Is there a simple way to convert this to “time ago”, so instead of
28 Feb 2015 it shows
3 days ago?
I somehow always hesitated to add this to the core, because of the required translations. Carrying translations around is a huge hassle and it already means a lot of work for the panel. In my opinion the perfect solution would be a plugin based on DateTime::diff.
How about adding it to the core but returning an array with the amount of days, weeks, years (positive/negative for time in the future/past)?
In this case it’s not only a question of translation but also of word order …