Skip to content

Commit

Permalink
"ago" modifiers should be absolute for bc
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Feb 20, 2025
1 parent 7c2bc84 commit 4c82f02
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Modifiers/CoreModifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public function dashify($value)
*/
public function daysAgo($value, $params)
{
return (int) $this->carbon($value)->diffInDays(Arr::get($params, 0));
return (int) abs($this->carbon($value)->diffInDays(Arr::get($params, 0)));
}

/**
Expand Down Expand Up @@ -1055,7 +1055,7 @@ public function hexToRgb($value)
*/
public function hoursAgo($value, $params)
{
return (int) $this->carbon($value)->diffInHours(Arr::get($params, 0));
return (int) abs($this->carbon($value)->diffInHours(Arr::get($params, 0)));
}

/**
Expand Down Expand Up @@ -1617,7 +1617,7 @@ public function md5($value)
*/
public function minutesAgo($value, $params)
{
return (int) $this->carbon($value)->diffInMinutes(Arr::get($params, 0));
return (int) abs($this->carbon($value)->diffInMinutes(Arr::get($params, 0)));
}

/**
Expand Down Expand Up @@ -1652,7 +1652,7 @@ public function modifyDate($value, $params)
*/
public function monthsAgo($value, $params)
{
return (int) $this->carbon($value)->diffInMonths(Arr::get($params, 0));
return (int) abs($this->carbon($value)->diffInMonths(Arr::get($params, 0)));
}

/**
Expand Down Expand Up @@ -2234,7 +2234,7 @@ public function segment($value, $params, $context)
*/
public function secondsAgo($value, $params)
{
return (int) $this->carbon($value)->diffInSeconds(Arr::get($params, 0));
return (int) abs($this->carbon($value)->diffInSeconds(Arr::get($params, 0)));
}

/**
Expand Down Expand Up @@ -2933,7 +2933,7 @@ public function values($value)
*/
public function weeksAgo($value, $params)
{
return (int) $this->carbon($value)->diffInWeeks(Arr::get($params, 0));
return (int) abs($this->carbon($value)->diffInWeeks(Arr::get($params, 0)));
}

/**
Expand Down Expand Up @@ -3045,7 +3045,7 @@ public function wordCount($value)
*/
public function yearsAgo($value, $params)
{
return (int) $this->carbon($value)->diffInYears(Arr::get($params, 0));
return (int) abs($this->carbon($value)->diffInYears(Arr::get($params, 0)));
}

/**
Expand Down

0 comments on commit 4c82f02

Please sign in to comment.