From 5cf475e88c359e4de9b241148a611e286a93915a Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 2 Aug 2023 11:36:28 -0700 Subject: [PATCH] Fix double negative #13463 part 2 --- src/helpers/DateTimeHelper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/helpers/DateTimeHelper.php b/src/helpers/DateTimeHelper.php index 67db51b3047..449a526f923 100644 --- a/src/helpers/DateTimeHelper.php +++ b/src/helpers/DateTimeHelper.php @@ -654,8 +654,7 @@ public static function toDateInterval(mixed $value): DateInterval|false if (is_numeric($value)) { // Use DateTime::diff() so the years/months/days/hours/minutes values are all populated correctly $now = static::now(new DateTimeZone('UTC')); - $operator = $value < 0 ? '-' : '+'; - $then = (clone $now)->modify("$operator$value seconds"); + $then = (clone $now)->modify(sprintf('%s%s seconds', $value < 0 ? '-' : '+', abs($value))); return $now->diff($then); }