Carbon: 1.37 AddMinute Method not found

Created on 3 May 2019  路  5Comments  路  Source: briannesbitt/Carbon


Hello,

I encountered an issue with the following code:

echo Carbon::now()->addMinute(30);

Carbon version: 1.37

PHP version: 7.2.10-0ubuntu0.18.04.1

I expected to get:

Date of the day + 30 minutes

But I actually get:

Exception: AddMinute method not found

There is no issue with prior versions like 1.36.2

Thanks!

Most helpful comment

I suggest you downgrade as a temporary fix until the issue is resolved:

composer require nesbot/carbon:1.36.2

This issue is a duplicate of #1708

All 5 comments

The latest update broke Laravel application is not even booting. Laravel 5.5 PHP 7.1.24

BadMethodCallException: Method addMinutes does not exist.
BadMethodCallException: Method addHours does not exist.

vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:96

if (! static::hasMacro($method)) {
throw new BadMethodCallException("Method {$method} does not exist.");
 }

I think is the "if and continue" in macro that was added recently
https://github.com/briannesbitt/Carbon/commit/f8a29bb3b0cf1f4dc94ba1deaeccd8084b206ce8#r33399864

I suggest you downgrade as a temporary fix until the issue is resolved:

composer require nesbot/carbon:1.36.2

This issue is a duplicate of #1708

Same goes for AddSeconds(). Noticed this bug using OctoberCMS

Duplicate #1708

Run composer update to get 1.37.1.

Was this page helpful?
0 / 5 - 0 ratings