Skip to content

Commit

Permalink
Removed odd and unexpected code in the within* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Sep 29, 2015
1 parent 72c2466 commit 50d8107
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
10 changes: 0 additions & 10 deletions src/DateTimeTrait.php
Expand Up @@ -1841,11 +1841,6 @@ public function isBirthday(ChronosInterface $dt)
*/
public function wasWithinLast($timeInterval)
{
$tmp = str_replace(' ', '', $timeInterval);
if (is_numeric($tmp)) {
$timeInterval = $tmp . ' days';
}

$now = new static();
$interval = $now->copy()->modify('-' . $timeInterval);

Expand All @@ -1861,11 +1856,6 @@ public function wasWithinLast($timeInterval)
*/
public function isWithinNext($timeInterval)
{
$tmp = str_replace(' ', '', $timeInterval);
if (is_numeric($tmp)) {
$timeInterval = $tmp . ' days';
}

$now = new static();
$interval = $now->copy()->modify('+' . $timeInterval);

Expand Down
1 change: 0 additions & 1 deletion tests/DateTime/IsTest.php
Expand Up @@ -465,7 +465,6 @@ public function testWasWithinLast($class)
$this->assertFalse((new $class('-1 year'))->wasWithinLast('1 second'));
$this->assertFalse((new $class('-1 year'))->wasWithinLast('0 year'));
$this->assertFalse((new $class('-1 weeks'))->wasWithinLast('1 day'));
$this->assertTrue((new $class('-3 days'))->wasWithinLast('5'));
}

/**
Expand Down

0 comments on commit 50d8107

Please sign in to comment.