Skip to content

Commit

Permalink
fix: TimeDifference property values are wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Mar 19, 2021
1 parent 2797039 commit c87349f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion system/I18n/TimeDifference.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function __get($name)

if (method_exists($this, $method))
{
return $this->{$method}($name);
return $this->{$method}();
}

return null;
Expand Down
8 changes: 8 additions & 0 deletions tests/system/I18n/TimeDifferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ public function testDifferenceBasics()
$this->assertEquals(-3682080, $obj->getMinutes());
$this->assertEquals(-220924800, $obj->getSeconds());

$this->assertEquals(-7, $obj->years);
$this->assertEquals(-84, $obj->months);
$this->assertEquals(-365, $obj->weeks);
$this->assertEquals(-2557, $obj->days);
$this->assertEquals(-61368, $obj->hours);
$this->assertEquals(-3682080, $obj->minutes);
$this->assertEquals(-220924800, $obj->seconds);

$this->assertEquals($diff / YEAR, $obj->getYears(true));
$this->assertEquals($diff / MONTH, $obj->getMonths(true));
$this->assertEquals($diff / WEEK, $obj->getWeeks(true));
Expand Down

0 comments on commit c87349f

Please sign in to comment.