From aaa8e4bf6a523b9f109d4c80069775ceada2be7a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 18 May 2015 14:40:55 +0200 Subject: [PATCH] Don't render time information when the timestamp evaluates to false refs #6778 --- library/Icinga/Web/View/helpers/format.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/View/helpers/format.php b/library/Icinga/Web/View/helpers/format.php index c5f7ca9e6..6011c954f 100644 --- a/library/Icinga/Web/View/helpers/format.php +++ b/library/Icinga/Web/View/helpers/format.php @@ -11,6 +11,9 @@ $this->addHelperFunction('format', function () { }); $this->addHelperFunction('timeAgo', function ($timestamp) { + if (! $timestamp) { + return ''; + } return sprintf( '%s', date('Y-m-d H:i:s', $timestamp), // TODO: internationalized format @@ -19,6 +22,9 @@ $this->addHelperFunction('timeAgo', function ($timestamp) { }); $this->addHelperFunction('timeSince', function ($timestamp) { + if (! $timestamp) { + return ''; + } return sprintf( '%s', date('Y-m-d H:i:s', $timestamp), // TODO: internationalized format @@ -27,7 +33,9 @@ $this->addHelperFunction('timeSince', function ($timestamp) { }); $this->addHelperFunction('timeUntil', function ($timestamp) { - if (! $timestamp) return ''; + if (! $timestamp) { + return ''; + } return sprintf( '%s', date('Y-m-d H:i:s', $timestamp), // TODO: internationalized format