From de9be044b3657799c6aef1a010ac6498ea069918 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 22 May 2015 10:04:00 +0200 Subject: [PATCH] lib: Provide formatDuration() in our views refs #6778 --- library/Icinga/Web/View/helpers/format.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/Icinga/Web/View/helpers/format.php b/library/Icinga/Web/View/helpers/format.php index a364f6cde..73257d079 100644 --- a/library/Icinga/Web/View/helpers/format.php +++ b/library/Icinga/Web/View/helpers/format.php @@ -24,6 +24,13 @@ $this->addHelperFunction('formatDateTime', function ($dateTime) { return DateFormatter::formatDateTime($dateTime); }); +$this->addHelperFunction('formatDuration', function ($seconds) { + if (! $seconds) { + return ''; + } + return DateFormatter::formatDuration($seconds); +}); + $this->addHelperFunction('formatTime', function ($time) { if (! $time) { return '';