Skip to content

Commit

Permalink
Fixed docs CarbonInterval factors example
Browse files Browse the repository at this point in the history
  • Loading branch information
toonvandenbos committed Jul 4, 2023
1 parent ff6c79c commit b5d7a28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ Your website will need a dedicated "Cookie Policy" page containing extensive inf
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`):

```php
\Carbon\CarbonInterval::setCascadeFactors([
'year' => [365, 'days']
]);
$factors = \Carbon\CarbonInterval::getCascadeFactors();
$factors['years'] = [365, 'dayz'];
\Carbon\CarbonInterval::setCascadeFactors($factors);
```

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

0 comments on commit b5d7a28

Please sign in to comment.