Skip to content

Commit

Permalink
Fix double negative
Browse files Browse the repository at this point in the history
#13463 part 2
  • Loading branch information
brandonkelly committed Aug 2, 2023
1 parent 6a071c2 commit 5cf475e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/helpers/DateTimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 5cf475e

Please sign in to comment.