From 3d159fe434f508d40d837aafb81f2c63a5161c90 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 30 Jun 2022 08:40:54 +0200 Subject: [PATCH] TimeRange: Accept strings in method `validateTime()` --- modules/monitoring/library/Monitoring/Timeline/TimeRange.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeRange.php b/modules/monitoring/library/Monitoring/Timeline/TimeRange.php index 26d72505e..08c7a2c3a 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeRange.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeRange.php @@ -119,12 +119,14 @@ class TimeRange implements Iterator /** * Return whether the given time is within this range of time * - * @param int|DateTime $time The timestamp or date and time to check + * @param string|int|DateTime $time The timestamp or date and time to check */ public function validateTime($time) { if ($time instanceof DateTime) { $dateTime = $time; + } elseif (is_string($time)) { + $dateTime = DateTime::createFromFormat('d/m/Y g:i A', $time); } else { $dateTime = new DateTime(); $dateTime->setTimestamp($time);