You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the dates: 2018-10-11 20:59:06.914653 and 2018-10-11 20:59:07.237419 they differ by 0.322766 seconds but diff() is reported as string(16) "00:00:01.-677234" when formatted via format('%H:%I:%S.%F')
Dump of DateInterval object:
class DateInterval#32 (16) {
public $y =>
int(0)
public $m =>
int(0)
public $d =>
int(0)
public $h =>
int(0)
public $i =>
int(0)
public $s =>
int(1)
public $f =>
double(-0.677234)
public $weekday =>
int(0)
public $weekday_behavior =>
int(0)
public $first_last_day_of =>
int(0)
public $invert =>
int(0)
public $days =>
int(0)
public $special_type =>
int(0)
public $special_amount =>
int(0)
public $have_weekday_relative =>
int(0)
public $have_special_relative =>
int(0)
}
Test script:
<?php
$startDate = new \DateTime('2018-10-11 20:59:06.914653');
$endDate = new \DateTime('2018-10-11 20:59:07.237419');
$interval = $startDate->diff($endDate);
var_dump($interval->format('%H:%I:%S.%F'));
Expected result:
string(16) "00:00:00.322766"
Actual result:
string(16) "00:00:01.-677234"
The text was updated successfully, but these errors were encountered:
Description:
timelib_do_rel_normalize()
does not normalize fractions by callingdo_range_limit_fraction()
resulting in incorrectDateInterval
values.Consider the dates:
2018-10-11 20:59:06.914653
and2018-10-11 20:59:07.237419
they differ by0.322766
seconds butdiff()
is reported asstring(16) "00:00:01.-677234"
when formatted viaformat('%H:%I:%S.%F')
Dump of
DateInterval
object:Test script:
Expected result:
string(16) "00:00:00.322766"
Actual result:
string(16) "00:00:01.-677234"
The text was updated successfully, but these errors were encountered: