Skip to content

Commit cf04a43

Browse files
committed
Fix unittest for leap years
Seems 2 days was not enough, this is now upped to 4 days instead. The unittest now passes.
1 parent 52422d7 commit cf04a43

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/TimeagoTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public function testTimeAgoInWords()
8484

8585
// seemed to be the easiest way to get 1 year - 1 second, which should be the day before 1 year ago :)
8686
$oneYearAgo = strtotime("-1 year");
87-
// NOTE: this fails around leap years... so... -2 days must be accurate enough
88-
$twoDays = (2*86400); // 2 days in seconds
87+
// NOTE: this fails around leap years... so... -4 days must be accurate enough
88+
$twoDays = (4*86400); // 4 days in seconds
8989
$this->assertContains('months ago', $timeAgo->inWordsFromStrings(date('c', $oneYearAgo + $twoDays)));
9090
$this->assertNotContains('months ago', $timeAgo->inWordsFromStrings(date('c', $oneYearAgo)));
9191

0 commit comments

Comments
 (0)