Closed tvb closed 9 years ago
Found it. It should be a round() and not a floor():
// If this happened over a day ago, return "x days ago".
elseif ($ago >= ($period = 60 * 60 * 24)) {
$days = floor($ago / $period);
return Ts("%d day ago", "%d days ago", $days);
}
to
// If this happened over a day ago, return "x days ago".
elseif ($ago >= ($period = 60 * 60 * 24)) {
$days = round($ago / $period);
return Ts("%d day ago", "%d days ago", $days);
}
I've changed all floor references in the relativeTime() function and it looks good now!
@tvb nice find. Go ahead and issue a pull request if you'd like and I'll merge it in.
I'll submit a pull request asap.
No pull request yet?
I confirm this, but not only for days, same stuff for the rest: replacing all the floor()
by round()
fixed the issue.
All of this in the core/lib/functions.general.php
file.
@jgknight if you want a pull request, I can create one.
@olivierlambert go ahead. I have not found the time to sumbit a pull request yet and probably will not find it in the coming weeks. Thanks!
Will do :)
I noticed the following scenario. 2 post boths posted
yesterday
according to esoTalk:However the first one is posted on the 24th so should say
posted 2 days ago
the second one is posted on the 25th, so should indeed say
yesterday
.