addHelperFunction('format', function () {
return Format::getInstance();
});
$this->addHelperFunction('timeAgo', function ($timestamp) {
if (! $timestamp) {
return '';
}
return sprintf(
'%s',
date('Y-m-d H:i:s', $timestamp), // TODO: internationalized format
Format::timeAgo($timestamp)
);
});
$this->addHelperFunction('timeSince', function ($timestamp) {
if (! $timestamp) {
return '';
}
return sprintf(
'%s',
date('Y-m-d H:i:s', $timestamp), // TODO: internationalized format
Format::timeSince($timestamp)
);
});
$this->addHelperFunction('timeUntil', function ($timestamp) {
if (! $timestamp) {
return '';
}
return sprintf(
'%s',
date('Y-m-d H:i:s', $timestamp), // TODO: internationalized format
Format::timeUntil($timestamp)
);
});
$this->addHelperFunction('dateTimeRenderer', function ($dateTimeOrTimestamp, $future = false) {
return DateTimeRenderer::create($dateTimeOrTimestamp, $future);
});