Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Wee statamic add-ons
* Time for humans
* {{ time_for_humans when="insert a time and/or date in any format here" }}
* For more details see:
use \Carbon\Carbon;
class Plugin_time_for_humans extends Plugin
public function index()
$when = $this->fetchParam('when', null, null, false, false);
return Carbon::parse($when)->diffForHumans();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment