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
Before the 3.0, the Carbon::diff method simply returned a \DateInterval but now there is an intermediate CarbonInterval object that is created with an interval_spec string.
As stated in the DateInterval phpdoc
If the DateInterval object was created by DateTimeImmutable::diff() or DateTime::diff(), then this is the total number of full days between the start and end dates. Otherwise, days will be false.
It's a problem for the days property, it's never set and unfortunately it can't be set manually. I tried a lot of things but I don't think there is an easy solution to handle this directly in the vendor
@daniser You can replace all the Carbon::diff in your code with the Carbon::diffAsDateInterval method to keep the same behaviour, or you can use the Carbon::diffInDays method but you'll get a float so don't forget to cast it if you need an integer
Hello,
I encountered an issue with the following code:
3
false
Carbon version: 3.3.1
PHP version: 8.3.4
I expected to get:
But I actually get:
Thanks!
The text was updated successfully, but these errors were encountered: