I'm trying to work around problem with php DateTime witch returns me weird values in some specific cases.
For example, my code:
$start = new \DateTime("2018-10-04 00:00");
$end = new \DateTime("2018-10-28 23:59");
$diff = $end->diff($start);
returns:
DateInterval {#2311 ▼
+"y": 0
+"m": 0
+"d": 25
+"h": -1
+"i": 59
+"s": 59
+"f": 0.0
+"weekday": 0
+"weekday_behavior": 0
+"first_last_day_of": 0
+"invert": 1
+"days": 24
+"special_type": 0
+"special_amount": 0
+"have_weekday_relative": 0
+"have_special_relative": 0
}
"25 days -1 hour 59 minutes".
Function works perfect in most cases. This happens only sometimes, but still being a problem... Is there any way to get normal format of days/hours without recalculating this weird values every time?