0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-02-06 15:00:04 +00:00
salesagility_SuiteCRM/include/Smarty/plugins/function.diff_for_humans.php
2018-08-06 11:16:47 +01:00

17 lines
No EOL
448 B
PHP

<?php
/**
* This smarty function will generate a carbon diff for humans.
*
* A diff for humans is something like: "31 seconds ago" or "54 days ago".
*
* The only parameter to pass is 'datetime', to be given in UTC.
*
* @param $params array
* @return string
* @see Carbon::diffForHumans()
*/
function smarty_function_diff_for_humans(array $params)
{
return \Carbon\Carbon::createFromTimeString($params['datetime'])->diffForHumans();
}