Skip to content

Commit b5d7a28

Browse files
committed
Fixed docs CarbonInterval factors example
1 parent ff6c79c commit b5d7a28

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,9 @@ Your website will need a dedicated "Cookie Policy" page containing extensive inf
403403
A side note on `Carbon\CarbonInterval`'s `cascade` method: when working with years, some unexpected results could appear. By default, the `CarbonInterval` "year" factor will return 336 days instead of 365. It is possible to change this by defining your own factors (for instance in `App\Providers\AppServiceProvider`):
404404

405405
```php
406-
\Carbon\CarbonInterval::setCascadeFactors([
407-
'year' => [365, 'days']
408-
]);
406+
$factors = \Carbon\CarbonInterval::getCascadeFactors();
407+
$factors['years'] = [365, 'dayz'];
408+
\Carbon\CarbonInterval::setCascadeFactors($factors);
409409
```
410410

411411
More information on CarbonInterval's gotchas in [Constantin's blog post on Cahsingcode.dev](https://chasingcode.dev/blog/carbon-php-practical-examples/).

0 commit comments

Comments
 (0)