mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Add view helper functions for formatting, date, date and time, and time
refs #6778
This commit is contained in:
parent
a66cb907ae
commit
d53c3d7075
@ -10,6 +10,27 @@ $this->addHelperFunction('format', function () {
|
|||||||
return Format::getInstance();
|
return Format::getInstance();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->addHelperFunction('formatDate', function ($date) {
|
||||||
|
if (! $date) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return DateFormatter::formatDate($date);
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->addHelperFunction('formatDateTime', function ($dateTime) {
|
||||||
|
if (! $dateTime) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return DateFormatter::formatDateTime($dateTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->addHelperFunction('formatTime', function ($time) {
|
||||||
|
if (! $time) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return DateFormatter::formatTime($time);
|
||||||
|
});
|
||||||
|
|
||||||
$this->addHelperFunction('timeAgo', function ($time, $timeOnly = false) {
|
$this->addHelperFunction('timeAgo', function ($time, $timeOnly = false) {
|
||||||
if (! $time) {
|
if (! $time) {
|
||||||
return '';
|
return '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user