fixed it:
line 538 in plugins/jetpack/modules/widgets/milestone/class-milestone-widget.php
change
return (int) ( $seconds / 60 / 60 / 24 + 1 );
to
return (int) ( $seconds / 60 / 60 / 24 + 0.5 );
Hi there,
I’m glad to hear you sorted this out by yourself 🙂
In case you need more help from us, please share your site URL next time so we’ll be able to take a look at it.
For now, I make this as solved. Cheers!
ah, but will u fix it so i don’t have to patch it in the next update?
protected function get_interval_in_units( $seconds, $units ) {
switch ( $units ) {
case 'years':
$years = $seconds / YEAR_IN_SECONDS;
$decimals = abs( round( $years, 1 ) - round( $years ) ) > 0 ? 1 : 0;
return number_format_i18n( $years, $decimals );
case 'months':
return (int) ( $seconds / 60 / 60 / 24 / 30 + 0.5);
case 'days':
return (int) ( $seconds / 60 / 60 / 24 + 0.5 );
case 'hours':
return (int) ( $seconds / 60 / 60 + 0.5);
case 'minutes':
return (int) ( $seconds / 60 + 0.5 );
default:
return $seconds;
}
}
(also note that all other units are cast to integer; above contains my patch for simple 1/2 rounding instead of rounding up; added roundings noted by lack of space after 0.5)
-
This reply was modified 5 years, 2 months ago by
airdrummer.
Thanks @airdrummer I’ve submitted this to our developers on Github so you can follow along there for any updates:
https://github.com/Automattic/jetpack/issues/18449