Skip to content

Commit b3150f2

Browse files
authored
Merge pull request jimmiw#73 from marlon-be/master
Fix issue jimmiw#72 calculate correctly "isLessThan44Min29Secs"
2 parents a0a2de2 + 9edb034 commit b3150f2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Westsworld/TimeAgo/Language.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ private function isLessThan44Min29Secs(DateInterval $timeDifference)
201201
return false;
202202
};
203203

204-
return $timeDifference->i < 45 &&
205-
$timeDifference->s < 30 &&
204+
return ($timeDifference->i < 44 ||
205+
($timeDifference->i === 44 && $timeDifference->s < 30)) &&
206206
! $this->isLessThan1Min29Seconds($timeDifference);
207207
}
208208

tests/TimeagoTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function testTimeAgoInWords()
4646

4747
// testing 2..44 minutes
4848
$this->assertContains('minutes ago', $timeAgo->inWordsFromStrings("-2 minute"));
49+
$this->assertContains('minutes ago', $timeAgo->inWordsFromStrings("-2 minute -40 second"));
4950
$this->assertContains('minutes ago', $timeAgo->inWordsFromStrings("-44 minute"));
5051
$this->assertContains('minutes ago', $timeAgo->inWordsFromStrings("-44 minute -29 second"));
5152
$this->assertNotContains('minutes ago', $timeAgo->inWordsFromStrings("-44 minute -30 second"));

0 commit comments

Comments
 (0)