1) Tests\Unit\Helpers\DateHelper::test_days_remaining
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
+'-2'
Carbon 3.x includes a changes made in the ♻️ Cleanup diffIn* diffInReal* floatDiffIn* floatDiffInReal* pull request that convert the return value to a float. This has something to do with a bug with DST calculation. This also seems to have resulted in positive return values becoming negative values.
This is a known breaking change in the Carbon library. It just tripped me up since in my case Carbon was updated by upgrading Laravel. I wasn’t specifically thinking of “What changed in Carbon?”
Affected Methods
The following methods in Carbon are affected:
It might also be a good occasion to review those calls and wonder “what if date in parameter is before the date on which the method is called?” and re-assert your code is correctly handling the case.
For instance if you have $value = $date->diffInHours($other) and $other is always before $date, then the relevant thing to do instead of using the absolute: true flag is rather to just take the opposite value: $value = - $date->diffInHours($other) or to flip them if $other is also a Carbon object: $value = $other->diffInHours($date) it will clear ambiguity.