From 190847e685463116e742e96681b9a6b70bdded19 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 12 Jan 2022 17:02:40 +0100 Subject: [PATCH] DateUtil::formatInterval returned empty string if interval is less than 60 seconds Closes #4632 --- wcfsetup/install/files/lib/util/DateUtil.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wcfsetup/install/files/lib/util/DateUtil.class.php b/wcfsetup/install/files/lib/util/DateUtil.class.php index da1a6e529f..b8934534df 100644 --- a/wcfsetup/install/files/lib/util/DateUtil.class.php +++ b/wcfsetup/install/files/lib/util/DateUtil.class.php @@ -227,6 +227,10 @@ final class DateUtil $weeks = \floor($days / 7); $hours = $interval->format('%h'); $minutes = $interval->format('%i'); + if (!$years && !$months && !$days && !$hours && !$minutes) { + // Prevents empty output if the interval is less than 60 seconds. + $minutes = 1; + } $direction = ''; switch ($interval->format('%R')) { -- 2.20.1