Skip to content

Commit d7969ce

Browse files
committed
Added docs note on CarbonInterval's factors
1 parent 691da65 commit d7969ce

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,16 @@ Your website will need a dedicated "Cookie Policy" page containing extensive inf
400400
<p>...</p>
401401
```
402402

403+
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`):
404+
405+
```php
406+
\Carbon\CarbonInterval::setCascadeFactors([
407+
'year' => [365, 'days']
408+
]);
409+
```
410+
411+
More information on CarbonInterval's gotchas in [Constantin's blog post on Cahsingcode.dev](https://chasingcode.dev/blog/carbon-php-practical-examples/).
412+
403413
### Let your users change their mind
404414

405415
Users should be able to change their consent settings at any time. No worries, with this package it is quite simple to achieve: generate a button that will reset the user's cookies and show the consent modal again.

0 commit comments

Comments
 (0)