I have an issue with DateInterval::$d
property with march 2016.
See the code:
$date1 = new \DateTime('2016-07-01');
$date2 = new \DateTime('2016-07-31');
$diff = date_diff($date1, $date2, true);
var_dump($diff->d); // int(0) => OK
$date1 = new \DateTime('2016-03-01');
$date2 = new \DateTime('2016-03-31');
$diff = date_diff($date1, $date2, true);
var_dump($diff->d); // int(1) => NOT OK
On the second example, I have 1 month difference (that is normal) and 1 extra day.
I don't understand at all why and I don't have this issue with another 31 days' month.
Is that a PHP bug or a bad usage of this property?